Exemplo n.º 1
0
 function add_article($data)
 {
     $config['upload_path'] = get_config_value('upload_news_path');
     $config['allowed_types'] = 'gif|jpg|jpeg|png';
     $config['max_size'] = get_config_value('max_size');
     $config['encrypt_name'] = TRUE;
     // rename to random string
     if ($_FILES['image']['name']) {
         $this->load->library('upload', $config);
         if ($this->upload->do_upload('image')) {
             $datax = $this->upload->data();
         } else {
             print_r($this->upload->display_errors());
             exit;
         }
     } else {
         $datax['file_name'] = NULL;
     }
     $this->db->set('title', $data['title']);
     $this->db->set('alias', seo_url($data['title']));
     $this->db->set('category_id', $data['category_id']);
     $this->db->set('image', $datax['file_name']);
     $this->db->set('short_content', $data['short_content']);
     $this->db->set('full_content', $data['full_content']);
     $this->db->set('time', time());
     $this->db->set('publish', 1);
     $result = $this->db->insert('article');
     return $result;
 }
Exemplo n.º 2
0
 function update_category($data)
 {
     $this->db->set('name', $data['name']);
     $this->db->set('alias', seo_url($data['name']));
     $this->db->where('id', $data['id']);
     $result = $this->db->update('category');
     return $result;
 }
Exemplo n.º 3
0
 public function update_slugs()
 {
     foreach ($this->get_all() as $row) {
         if ($row['slug'] == '') {
             $data['slug'] = strtolower(seo_url($row['title']));
             $this->update($row['id'], $data);
         }
     }
 }
Exemplo n.º 4
0
run_hook('admin_editpage_before');
//Include page information, if we're editing a page.
if (isset($_GET['page']) && file_exists(PAGE_DIR . '/' . get_page_filename($_GET['page']))) {
    require_once PAGE_DIR . '/' . get_page_filename($_GET['page']);
}
//If form is posted...
if (isset($_POST['save']) || isset($_POST['save_exit'])) {
    //Allow modules to add data to page
    $module_additional_data = null;
    run_hook('admin_save_page_afterpost', array(&$module_additional_data));
    if (!isset($_POST['hidden'])) {
        $_POST['hidden'] = 'yes';
    }
    //Save the page, but only if a title has been entered and it's seo url is not empty.
    if (!empty($_POST['title']) && seo_url($_POST['title'])) {
        if (!empty($_POST['seo_name']) && $_POST['seo_name'] != seo_url($_POST['title'])) {
            $title = array('title' => $_POST['title'], 'seo_name' => trim(str_replace(array('\\', '/', ':', '*', '?', '"', '<', '>', '|'), '', $_POST['seo_name'])));
        } else {
            $title = $_POST['title'];
        }
        //If we are editing an existing page, pass current seo-name.
        if (isset($_GET['page'])) {
            $seoname = save_page($title, $_POST['content'], $_POST['hidden'], $_POST['sub_page'], $_POST['description'], $_POST['keywords'], $module_additional_data, $_GET['page']);
        } else {
            //If we are creating a new page, don't pass seo-name.
            $seoname = save_page($title, $_POST['content'], $_POST['hidden'], $_POST['sub_page'], $_POST['description'], $_POST['keywords'], $module_additional_data);
        }
        //If seoname is false, a file already exists with the same name
        if (empty($seoname)) {
            $error = show_error($lang['page']['name_exists'], 1, true);
        }
Exemplo n.º 5
0
    <h2>
      <?php 
_e('SEO Title and Meta Description', SEO_PLUGIN_FOLDER);
?>
    </h2>
    <div class="form-group">
      <label class="form-label" for="seo_item_meta_title">
        <?php 
_e('Snippet Preview', SEO_PLUGIN_FOLDER);
?>
        : </label>
      <div class="form-controls" id="seo_snippet_preview"> <a class="preview_title" id="preview_title"><?php 
echo $detail['seo_item_meta_title'];
?>
</a> <span class="preview_url"><?php 
echo str_replace('http://', '', osc_base_url()) . seo_url($detail['seo_item_meta_title']);
?>
</span>
        <p class="preview_desc"><?php 
echo $detail['seo_item_meta_description'];
?>
</p>
      </div>
    </div>
    <div class="form-group" id="seo_item_meta">
      <div class="form-control-list">
        <label for="seo_item_meta_title">
          <?php 
_e('Meta Title', SEO_PLUGIN_FOLDER);
?>
          : </label>
Exemplo n.º 6
0
function blog_page_admin_newpost()
{
    global $lang, $var1, $cont1, $cont2, $cont3;
    //If form is posted...
    if (isset($_POST['save']) || isset($_POST['save_exit'])) {
        if (seo_url($cont1)) {
            //Save blogpost.
            $seoname = blog_save_post($cont1, $cont2, $cont3);
            //Redirect user.
            if (isset($_POST['save'])) {
                redirect('?module=blog&page=editpost&var1=' . $seoname, 0);
            } else {
                redirect('?module=blog', 0);
            }
        } else {
            $error = show_error($lang['page']['no_title'], 1, true);
        }
    }
    if (isset($error)) {
        echo $error;
    }
    ?>
		<div class="rightmenu">
			<p><?php 
    echo $lang['page']['items'];
    ?>
</p>
			<?php 
    show_link_insert_box();
    show_image_insert_box('images');
    ?>
		</div>
		<form method="post" action="">
			<p>
				<label class="kop2" for="cont1"><?php 
    echo $lang['general']['title'];
    ?>
</label>
				<input name="cont1" id="cont1" type="text" />
			</p>
			<p>
			<label class="kop2" for="cont2"><?php 
    echo $lang['blog']['category'];
    ?>
</label>
			<select name="cont2" id="cont2">
				<option value=""><?php 
    echo $lang['blog']['choose_cat'];
    ?>
</option>
				<?php 
    //If there are categories.
    if ($categories = blog_get_categories()) {
        foreach ($categories as $category) {
            echo '<option value="' . $category['seoname'] . '">' . $category['title'] . '</option>';
        }
        unset($key);
    }
    ?>
			</select>
			</p>
			<p>
				<label class="kop2" for="cont3"><?php 
    echo $lang['general']['contents'];
    ?>
</label>
				<textarea class="<?php 
    if (defined('WYSIWYG_TEXTAREA_CLASS')) {
        echo WYSIWYG_TEXTAREA_CLASS;
    }
    ?>
" name="cont3" id="cont3" cols="70" rows="20"></textarea>
			</p>
			<?php 
    show_common_submits('?module=blog', true);
    ?>
		</form>
	<?php 
}
 function update_deal_category()
 {
     if ($_FILES['white_icon']['name']) {
         $white_icon = $this->load_white_icon_name($this->input->post('id'));
         unlink('upload/deal_category/' . $white_icon);
         $config['upload_path'] = get_config_value('upload_deal_category_path');
         $config['allowed_types'] = 'gif|jpg|jpeg|png';
         $config['max_size'] = get_config_value('max_size');
         $config['encrypt_name'] = TRUE;
         // rename to random string
         $this->load->library('upload', $config);
         if ($this->upload->do_upload('white_icon')) {
             $datax = $this->upload->data();
             $this->db->set('white_icon', $datax['file_name']);
         } else {
             print_r($this->upload->display_errors());
             exit;
         }
     }
     if ($_FILES['red_icon']['name']) {
         $red_icon = $this->load_red_icon_name($this->input->post('id'));
         unlink('upload/deal_category/' . $red_icon);
         $config['upload_path'] = get_config_value('upload_deal_category_path');
         $config['allowed_types'] = 'gif|jpg|jpeg|png';
         $config['max_size'] = get_config_value('max_size');
         $config['encrypt_name'] = TRUE;
         // rename to random string
         $this->load->library('upload', $config);
         if ($this->upload->do_upload('red_icon')) {
             $datax = $this->upload->data();
             $this->db->set('red_icon', $datax['file_name']);
         } else {
             print_r($this->upload->display_errors());
             exit;
         }
     }
     $this->db->set('name', $this->input->post('name'));
     $this->db->set('alias', seo_url($this->input->post('name')));
     $this->db->where('id', $this->input->post('id'));
     $result = $this->db->update('deal_category');
     return $result;
 }
 public function editPublisherProcess($id)
 {
     $name = Input::get('name');
     $cat_img = Input::file('picture');
     $publisher = Publisher::find($id);
     if ($publisher) {
         $publisher->name = $name;
         $validator = Validator::make(array('picture' => $cat_img), array('picture' => 'required|mimes:jpeg,bmp,gif,png'));
         if ($validator->fails()) {
             //do nothing
         } else {
             $file_name = seo_url(Input::get('name')) . '-' . time();
             $ext = Input::file('picture')->getClientOriginalExtension();
             Input::file('picture')->move(public_path() . "/uploads", $file_name . "." . $ext);
             $local_url = $file_name . "." . $ext;
             $s3_url = URL::to('/') . '/uploads/' . $local_url;
             $publisher->image = $s3_url;
         }
         $publisher->save();
         if ($publisher) {
             return Redirect::back()->with('flash_success', tr('publisher_update'));
         } else {
             return Redirect::back()->with('flash_error', tr('went_wrong'));
         }
     }
 }
Exemplo n.º 9
0
    		<td><?php 
        echo date("d-m-Y", $rows['time']);
        ?>
<br/>
            til: <?php 
        echo date("d-m-Y", $rows['end_date']);
        ?>
</td>
    		<td><a href="<?php 
        echo base_url() . index_page();
        ?>
sugarshop/detail/<?php 
        echo $rows['id'];
        ?>
/<?php 
        echo seo_url($rows['name']);
        ?>
.html"><?php 
        echo $rows['name'];
        ?>
</a></td>
    		<td class="txt-center"><?php 
        echo $rows['quantity']->quantity;
        ?>
</td>
    		<td class="txt-center"><a href="<?php 
        echo base_url() . index_page();
        ?>
b2b/detail/<?php 
        echo $rows['id'];
        ?>
Exemplo n.º 10
0
 function save_edit()
 {
     if ($_FILES['image']['name']) {
         $image = $this->article_model->load_image_name($this->input->post('id'));
         unlink('upload/images/' . $image);
         $config['upload_path'] = get_config_value('upload_news_path');
         $config['allowed_types'] = 'gif|jpg|jpeg|png';
         $config['max_size'] = get_config_value('max_size');
         $config['encrypt_name'] = TRUE;
         // rename to random string
         $this->load->library('upload', $config);
         if ($this->upload->do_upload('image')) {
             $datax = $this->upload->data();
             $data['image'] = $datax['file_name'];
         } else {
             print_r($this->upload->display_errors());
             exit;
         }
     }
     $data['title'] = $this->input->post('title');
     $data['alias'] = seo_url($this->input->post('title'));
     $data['category_id'] = $this->input->post('category_id');
     $data['short_content'] = html_entity_decode($this->input->post('short_content'), ENT_QUOTES, "UTF-8");
     $data['full_content'] = html_entity_decode($this->input->post('full_content'), ENT_QUOTES, "UTF-8");
     $isOK = $this->article_model->update_article($this->input->post('id'), $data);
     if ($isOK) {
         $this->session->set_flashdata('message', 'Information is saved');
         redirect('/article');
     } else {
         $this->session->set_flashdata('message', 'Can\'t save information');
         redirect('/article');
     }
 }
Exemplo n.º 11
0
        ?>
thumbnail/timthumb.php?src=<?php 
        echo base_url() . get_config_value('upload_deal_category_path') . $rows['white_icon'];
        ?>
&q=100&w=33&h=33"/>
                    <div class="common-popup">
                        <div class="top"><span class="arrow"></span></div>
                        <div class="content">
                            <?php 
        if ($rows['dealID']) {
            ?>
                            <a style="color: #ffffff; font-size: 13px;" href="<?php 
            echo base_url() . index_page();
            ?>
sugarshop/detail/<?php 
            echo $rows['dealID'] . "/" . seo_url($rows['dealName']);
            ?>
.html"><?php 
            echo $rows['dealName'];
            ?>
</a>
                            <?php 
        } else {
            ?>
                                <p style="color: #ffffff; font-size: 13px;"><?php 
            echo $rows['dealName'];
            ?>
</p>
                            <?php 
        }
        ?>
Exemplo n.º 12
0
/**
 * Save a page with a lot of options.
 *
 * @since 4.7
 * @package admin
 * @param mixed $title if string - The title, if array title => The title, seo_name => The seo_name.
 * @param string $content The content.
 * @param string $hidden Should it be hidden ('yes' or 'no')?
 * @param string $subpage Specifies the parent page, if the saved page should be a sub page. Default to null.
 * @param string $description Description of the page. Defaults to null.
 * @param string $keywords Keywords of the page. Defaults to null.
 * @param array $module_additional_data Additional data variable, can be edited by modules through hooks (admin_save_page_module_additional_data). Defaults to null.
 * @param string $current_seoname Current seoname of the page, if we are editing a page. Defaults to null.
 * @return string Seoname of the saved page.
 */
function save_page($title, $content, $hidden, $subpage = null, $description = null, $keywords = null, $module_additional_data = null, $current_seoname = null)
{
    //Run a few hooks.
    run_hook('admin_save_page', array(&$title, &$content));
    run_hook('admin_save_page_meta', array(&$description, &$keywords));
    run_hook('admin_save_page_module_additional_data', array(&$module_additional_data));
    //Configure title and seo_name
    if (is_array($title)) {
        if (!empty($title['seo_name'])) {
            $seo_title = $title['seo_name'];
            $title = $title['title'];
        } else {
            $seo_title = seo_url($title['title']);
            $title = $title['title'];
        }
    } else {
        $seo_title = seo_url($title);
    }
    //Check if the seo url  is empty.
    if (empty($seo_title)) {
        return false;
    }
    //Check if a page already exists with the name.
    if ((!isset($current_seoname) || $current_seoname != $subpage . $seo_title) && get_page_filename($subpage . $seo_title) != false) {
        return false;
    }
    //Do we want to create a new page?
    if (!isset($current_seoname)) {
        //Check if we want a sub-page.
        if (!empty($subpage)) {
            //We need to make sure that the dir exists, and if not, create it.
            if (!file_exists(PAGE_DIR . '/' . rtrim($subpage, '/'))) {
                mkdir(PAGE_DIR . '/' . rtrim($subpage, '/'));
                chmod(PAGE_DIR . '/' . rtrim($subpage, '/'), 0777);
            }
            $pages = read_dir_contents(PAGE_DIR . '/' . rtrim($subpage, '/'), 'files');
        } else {
            $pages = read_dir_contents(PAGE_DIR, 'files');
        }
        //Are there any pages?
        if ($pages == false) {
            $number = 1;
        } else {
            $number = count($pages) + 1;
        }
        $newfile = $subpage . $number . '.' . $seo_title;
    } else {
        $filename = get_page_filename($current_seoname);
        //the old file name
        //Is it a sub-page, or do we want to make it one?
        if (strpos($current_seoname, '/') !== false || !empty($subpage)) {
            $page_name = explode('/', $subpage);
            $count = count($page_name);
            unset($page_name[$count]);
            $dir = get_sub_page_dir($current_seoname);
            $filename_array = str_replace($dir . '/', '', $filename);
            $filename_array = explode('.', $filename_array);
            $newfilename = implode('/', $page_name) . '/' . $filename_array[0] . '.' . $seo_title;
            $newdir = get_sub_page_dir($newfilename);
            //We need to make sure that the dir exists, and if not, create it.
            if (!file_exists(PAGE_DIR . '/' . $newdir)) {
                mkdir(PAGE_DIR . '/' . $newdir);
                chmod(PAGE_DIR . '/' . $newdir, 0777);
            }
            //If the name isn't the same as before, we have to find the correct number.
            if ($newfilename . '.php' != $filename) {
                //If the sub-folder is the same, use the same number as before.
                if ($dir . '/' == $newdir) {
                    $number = $filename_array[0];
                } else {
                    $pages = read_dir_contents(PAGE_DIR . '/' . $newdir, 'files');
                    if ($pages) {
                        $count = count($pages);
                        $number = $count + 1;
                    } else {
                        $number = 1;
                    }
                }
                $newfile = implode('/', $page_name) . $number . '.' . $seo_title;
            }
        } else {
            $filename_array = explode('.', $filename);
            $newfile = $filename_array[0] . '.' . $seo_title;
        }
    }
    //Save the title, content and hidden status.
    $data = '<?php' . "\n" . '$title = \'' . sanitize($title) . '\';' . "\n" . '$seoname = \'' . sanitize($seo_title) . '\';' . "\n" . '$content = \'' . sanitize($content, false) . '\';' . "\n" . '$hidden = \'' . $hidden . '\';';
    //Save the description and keywords, if any.
    if ($description != null) {
        $data .= "\n" . '$description = \'' . sanitize($description) . '\';';
    }
    if ($keywords != null) {
        $data .= "\n" . '$keywords = \'' . sanitize($keywords) . '\';';
    }
    //If modules have supplied additional data, save it.
    if ($module_additional_data != null && is_array($module_additional_data)) {
        foreach ($module_additional_data as $var => $value) {
            $data .= "\n" . '$' . $var . ' = \'' . $value . '\';';
        }
    }
    $data .= "\n" . '?>';
    //Save the file.
    save_file(PAGE_DIR . '/' . $newfile . '.php', $data);
    //Do a little cleanup if we are editing a page.
    if (isset($current_seoname)) {
        //Check if the title is different from what we started with.
        if ($newfile . '.php' != $filename) {
            //If there are sub-pages, rename the folder.
            if (file_exists(PAGE_DIR . '/' . get_page_seoname($filename))) {
                rename(PAGE_DIR . '/' . get_page_seoname($filename), PAGE_DIR . '/' . get_page_seoname($newfile . '.php'));
            }
            //Remove the old file.
            unlink(PAGE_DIR . '/' . $filename);
            //If there are no files in the old dir, delete it.
            if (isset($dir) && read_dir_contents(PAGE_DIR . '/' . $dir, 'files') == false) {
                rmdir(PAGE_DIR . '/' . $dir);
            } elseif (isset($dir)) {
                reorder_pages(PAGE_DIR . '/' . $dir);
            } else {
                reorder_pages(PAGE_DIR);
            }
        }
    }
    //Return the seoname.
    return get_page_seoname($newfile . '.php');
}
Exemplo n.º 13
0
/**
 * Create a blog category.
 *
 * @param string $category The name of the category that needs to be created.
 */
function blog_create_category($category)
{
    //Check if 'categories' directory exists, if not; create it.
    if (!is_dir(BLOG_CATEGORIES_DIR)) {
        mkdir(BLOG_CATEGORIES_DIR);
        chmod(BLOG_CATEGORIES_DIR, 0777);
    }
    $data['category_title'] = sanitize($category);
    save_file(BLOG_CATEGORIES_DIR . '/' . seo_url($category) . '.php', $data);
}
Exemplo n.º 14
0
 function get_topic($page = false)
 {
     global $datastore;
     $xml = '';
     $this->priority = $this->topic_priority;
     if ($page) {
         $page = $page - 1;
         $page = $page * 40000;
         $this->limit = " LIMIT {$page},40000";
     } else {
         if ($this->limit < 1) {
             $this->limit = false;
         }
         if ($this->limit) {
             $this->limit = " LIMIT 0," . $this->limit;
         } else {
             $this->limit = '';
         }
     }
     if (!($forums = $datastore->get('cat_forums'))) {
         $datastore->update('cat_forums');
         $forums = $datastore->get('cat_forums');
     }
     $not_forums_id = $forums['not_auth_forums']['guest_view'];
     $ignore_forum_sql = $not_forums_id ? "WHERE forum_id NOT IN({$not_forums_id})" : '';
     $sql = DB()->sql_query("SELECT topic_id, topic_title, topic_time FROM " . BB_TOPICS . " " . $ignore_forum_sql . " ORDER BY topic_time ASC" . $this->limit);
     while ($row = DB()->sql_fetchrow($sql)) {
         if (function_exists('seo_url')) {
             $loc = $this->home . seo_url(TOPIC_URL . $row['topic_id'], $row['topic_title']);
         } else {
             $loc = $this->home . TOPIC_URL . $row['topic_id'];
         }
         $xml .= $this->get_xml($loc, date('c', $row['topic_time']));
     }
     return $xml;
 }
Exemplo n.º 15
0
 function update_deal()
 {
     if ($_FILES['image1']['name']) {
         $image = $this->load_image_name($this->input->post('id'));
         unlink('upload/deal/' . $image->image1);
         $config['upload_path'] = get_config_value('upload_deal_path');
         $config['allowed_types'] = 'gif|jpg|jpeg|png';
         $config['max_size'] = get_config_value('max_size');
         $config['encrypt_name'] = TRUE;
         // rename to random string
         $this->load->library('upload', $config);
         if ($this->upload->do_upload('image1')) {
             $datax = $this->upload->data();
             $this->db->set('image1', $datax['file_name']);
         } else {
             print_r($this->upload->display_errors());
             exit;
         }
     }
     if ($_FILES['image2']['name']) {
         $image = $this->load_image_name($this->input->post('id'));
         unlink('upload/deal/' . $image->image2);
         $config['upload_path'] = get_config_value('upload_deal_path');
         $config['allowed_types'] = 'gif|jpg|jpeg|png';
         $config['max_size'] = get_config_value('max_size');
         $config['encrypt_name'] = TRUE;
         // rename to random string
         $this->load->library('upload', $config);
         if ($this->upload->do_upload('image2')) {
             $datax = $this->upload->data();
             $this->db->set('image2', $datax['file_name']);
         } else {
             print_r($this->upload->display_errors());
             exit;
         }
     }
     if ($_FILES['image3']['name']) {
         $image = $this->load_image_name($this->input->post('id'));
         unlink('upload/deal/' . $image->image3);
         $config['upload_path'] = get_config_value('upload_deal_path');
         $config['allowed_types'] = 'gif|jpg|jpeg|png';
         $config['max_size'] = get_config_value('max_size');
         $config['encrypt_name'] = TRUE;
         // rename to random string
         $this->load->library('upload', $config);
         if ($this->upload->do_upload('image3')) {
             $datax = $this->upload->data();
             $this->db->set('image3', $datax['file_name']);
         } else {
             print_r($this->upload->display_errors());
             exit;
         }
     }
     if ($_FILES['image4']['name']) {
         $image = $this->load_image_name($this->input->post('id'));
         unlink('upload/deal/' . $image->image4);
         $config['upload_path'] = get_config_value('upload_deal_path');
         $config['allowed_types'] = 'gif|jpg|jpeg|png';
         $config['max_size'] = get_config_value('max_size');
         $config['encrypt_name'] = TRUE;
         // rename to random string
         $this->load->library('upload', $config);
         if ($this->upload->do_upload('image4')) {
             $datax = $this->upload->data();
             $this->db->set('image4', $datax['file_name']);
         } else {
             print_r($this->upload->display_errors());
             exit;
         }
     }
     $tmp = explode('-', $this->input->post('date'));
     $end_date = mktime($this->input->post('hour'), $this->input->post('minute'), 0, $tmp[1], $tmp[0], $tmp[2]);
     $this->db->set('name', $this->input->post('name'));
     $this->db->set('alias', seo_url($this->input->post('name')));
     $this->db->set('category_id', $this->input->post('category_id'));
     $this->db->set('b2b_id', $this->input->post('b2b_id'));
     $this->db->set('title', $this->input->post('title'));
     $this->db->set('description', $this->input->post('description'));
     $this->db->set('old_price', $this->input->post('old_price'));
     $this->db->set('new_price', $this->input->post('new_price'));
     $this->db->set('quantity', $this->input->post('quantity'));
     $this->db->set('end_date', $end_date);
     $this->db->where('id', $this->input->post('id'));
     $result = $this->db->update('deal');
     return $result;
 }
Exemplo n.º 16
0
 function update_product($data)
 {
     $this->db->trans_start();
     $config['upload_path'] = $this->config->item('product_file_location');
     $config['allowed_types'] = 'gif|jpg|jpeg|png';
     $config['max_size'] = $this->config->item('max_image_size');
     $config['encrypt_name'] = TRUE;
     // rename to random string
     $this->load->library('upload', $config);
     // upload multiple images
     if ($_FILES['fullimage']['name'][0] != '') {
         $n = count($_FILES['fullimage']['name']);
     } else {
         $n = 0;
     }
     if ($n > 0) {
         $num = $this->get_number_image_product($data['currentid']);
         $update_image_num = $this->config->item('max_number_of_image') - $num;
         if (isset($data['updateall'])) {
             $update_image_num = '';
         }
         if ($this->upload->do_multiple_upload($_FILES['fullimage'], $update_image_num)) {
             if ($num < 1 || isset($data['updateall'])) {
                 $full_images = "," . implode(",", $this->upload->get_unique_file_names()) . ",";
             } else {
                 $res = $this->get_image_product_detail($data['currentid']);
                 $res = $res->result_array();
                 $current_image = $res[0]['big_image'];
                 $full_images = $current_image . implode(",", $this->upload->get_unique_file_names()) . ",";
             }
             $this->db->set('big_image', $full_images);
         } else {
             return -1;
         }
     }
     // upload 1 images
     if ($_FILES['userfile']['name']) {
         if ($this->upload->do_upload()) {
             $datax = $this->upload->data();
             $thumb_images = $datax['file_name'];
             $this->db->set('thumb_image', $thumb_images);
         } else {
             return -1;
         }
     }
     //echo $full_images." ===  ".$datax['file_name'];
     $cate_arr = $data['articlecategory'];
     $product_category = ',';
     foreach ($cate_arr as $cate) {
         $product_category .= $cate . ',';
     }
     //echo "<br>".$product_category;
     $this->db->set('category_id', $product_category);
     $this->db->set('name_id', $data['nameid']);
     $this->db->set('manufacturer_id', $data['manufacturercategory']);
     $this->db->set('status', $data['publish']);
     $this->db->set('price', $data['price']);
     $this->db->set('sort_order', $data['sorting']);
     $this->db->set('is_special', $data['special']);
     $this->db->set('new_product', $data['new_product']);
     $this->db->where('product_id', $data['currentid']);
     $this->db->update('product');
     $arr['seo'] = seo_url($data['title']);
     // load from helper
     $this->db->set('language_code', $this->config->item('default_langcode'));
     $this->db->set('name', $data['title']);
     $this->db->set('name_alias', $arr['seo']);
     $this->db->set('short_des', $data['introduction']);
     $this->db->set('description', $data['maincontent']);
     $this->db->where('product_id', $data['currentid']);
     $this->db->update('product_description');
     $this->db->trans_complete();
     // end TRANSACTION
     if ($this->db->trans_status() == FALSE) {
         return 0;
     } else {
         return 1;
     }
 }
Exemplo n.º 17
0
function albums_page_admin_editalbum()
{
    global $cont1, $cont2, $cont3, $lang, $var1;
    //Let's process the image...
    if (isset($_POST['submit'])) {
        //If file is jpeg, pjpeg, png or gif: Accept.
        if (in_array($_FILES['imagefile']['type'], array('image/jpeg', 'image/pjpeg', 'image/png', 'image/gif'))) {
            //Define some variables
            $extpos = strrpos($_FILES['imagefile']['name'], '.');
            if ($extpos === false) {
                $extpos = strlen($_FILES['imagefile']['name']);
            }
            $image_filename = substr($_FILES['imagefile']['name'], 0, $extpos);
            $ext = substr($_FILES['imagefile']['name'], $extpos + 1);
            $image_filename = seo_url($image_filename);
            $fullimage = ALBUMS_DIR . '/' . $var1 . '/' . $image_filename . '.' . strtolower($ext);
            $thumbimage = ALBUMS_DIR . '/' . $var1 . '/thumb/' . $image_filename . '.' . strtolower($ext);
            //Check if the image name already exists.
            $images = read_dir_contents(ALBUMS_DIR . '/' . $var1 . '/thumb', 'files');
            if ($images) {
                foreach ($images as $image) {
                    $extpos = strrpos($image, '.');
                    if ($extpos === false) {
                        $extpos = strlen($image);
                    }
                    $namepart = substr($image, 0, $extpos);
                    if ($namepart == $image_filename) {
                        $name_exist = true;
                        break;
                    }
                }
            }
            //Don't do anything, if the name already exists.
            if (isset($name_exist)) {
                $error = show_error($lang['albums']['image_exist'], 1, true);
            } elseif (!copy($_FILES['imagefile']['tmp_name'], $fullimage) || !copy($_FILES['imagefile']['tmp_name'], $thumbimage)) {
                $error = show_error($lang['general']['upload_failed'], 1, true);
            } else {
                //Compress the big image.
                $image_width = module_get_setting('albums', 'resize_image_width');
                $image = new SmartImage($fullimage);
                //Only resize if resize_image_width is not disabled (or set to 1, which would produce errors).
                if ($image_width != '0' && $image_width != '1') {
                    list($width, $height) = getimagesize($fullimage);
                    $imgratio = $width / $height;
                    if ($imgratio > 1) {
                        $newwidth = $image_width;
                        $newheight = $image_width / $imgratio;
                    } else {
                        $newheight = $image_width;
                        $newwidth = $image_width * $imgratio;
                    }
                    $image->resize($newwidth, $newheight);
                }
                $image->saveImage($fullimage, $cont3);
                $image->close();
                chmod($fullimage, 0777);
                //Then make a thumb from the image.
                $thumb_width = module_get_setting('albums', 'resize_thumb_width');
                //If resize_thumb_width is set to 0 or 1, we need to grab the default width (otherwise it would produce errors).
                if ($thumb_width == '0' || $thumb_width == '1') {
                    $albums_default_settings = albums_settings_default();
                    $thumb_width = $albums_default_settings['resize_thumb_width'];
                }
                //Resize thumb.
                $thumb = new SmartImage($thumbimage);
                list($width, $height) = getimagesize($thumbimage);
                $imgratio = $width / $height;
                if ($imgratio > 1) {
                    $newwidth = $thumb_width;
                    $newheight = $thumb_width / $imgratio;
                } else {
                    $newheight = $thumb_width;
                    $newwidth = $thumb_width * $imgratio;
                }
                $thumb->resize($newwidth, $newheight);
                $thumb->saveImage($thumbimage, $cont3);
                $thumb->close();
                chmod($thumbimage, 0777);
                //Find the number.
                $images = read_dir_contents(ALBUMS_DIR . '/' . $var1 . '/thumb', 'files');
                if ($images) {
                    $number = count($images);
                } else {
                    $number = 1;
                }
                //Sanitize data.
                $cont1 = sanitize($cont1);
                $cont2 = sanitize($cont2);
                $cont2 = nl2br($cont2);
                //Compose the data.
                $data['name'] = $cont1;
                $data['info'] = $cont2;
                //Then save the image information.
                save_file(ALBUMS_DIR . '/' . $var1 . '/' . $number . '.' . $image_filename . '.' . strtolower($ext) . '.php', $data);
            }
        } else {
            //FIXME: Maybe a better error message?
            $error = show_error($lang['general']['upload_failed'], 1, true);
        }
    }
    //Check if album exists.
    if (file_exists(ALBUMS_DIR . '/' . $var1)) {
        //Introduction text.
        ?>
			<p>
				<strong><?php 
        echo $lang['albums']['album_message1'];
        ?>
</strong>
			</p>
			<p>
				<span class="kop2"><?php 
        echo $lang['albums']['new_image'];
        ?>
</span>
				<span class="kop4"><?php 
        echo $lang['albums']['album_message2'];
        ?>
</span>
			</p>
			<?php 
        if (isset($error)) {
            echo $error;
        }
        ?>
			<form method="post" action="" enctype="multipart/form-data">
				<p>
					<label class="kop2" for="cont1"><?php 
        echo $lang['general']['title'];
        ?>
</label>
					<input required='required' name="cont1" id="cont1" type="text" />
				</p>
				<p>
					<label class="kop2" for="cont2"><?php 
        echo $lang['general']['description'];
        ?>
</label>
					<textarea required='required' cols="50" rows="5" name="cont2" id="cont2"></textarea>
				</p>
				<p>
					<input type="file" name="imagefile" id="imagefile" />
					<label class="kop4" for="cont3"><?php 
        echo $lang['albums']['quality'];
        ?>
</label>
					<input name="cont3" id="cont3" type="text" size="3" value="85" />
				</p>
				<input type="submit" name="submit" value="<?php 
        echo $lang['general']['save'];
        ?>
" />
			</form>
			<br />
		<?php 
        //Edit images.
        ?>
		<span class="kop2"><?php 
        echo $lang['albums']['edit_images'];
        ?>
</span>
		<?php 
        albums_admin_show_images($var1);
    }
    ?>
		<br />
		<p>
			<a href="?module=albums">&lt;&lt;&lt; <?php 
    echo $lang['general']['back'];
    ?>
</a>
		</p>
	<?php 
}
 public function profilePics()
 {
     $validator = Validator::make(array('profile_pic' => Input::file('profile_pic')), array('profile_pic' => 'required|mimes:jpeg,bmp,gif,png'));
     if ($validator->fails()) {
         $error = $validator->messages()->all();
         return Redirect::back()->with('flash_errors', $error);
     } else {
         $admin = User::find(Auth::user()->id);
         $file_name = seo_url(Setting::get('sitename')) . '-' . Auth::user()->author_name . '-' . time();
         $ext = Input::file('profile_pic')->getClientOriginalExtension();
         Input::file('profile_pic')->move(public_path() . "/uploads", $file_name . "." . $ext);
         $local_url = $file_name . "." . $ext;
         $s3_url = URL::to('/') . '/uploads/' . $local_url;
         $admin->profile_pic = $s3_url;
         $admin->save();
         if ($admin) {
             return Redirect::back()->with('flash_success', "Updated successfully");
         } else {
             return Redirect::back()->with('flash_error', "Something went wrong");
         }
     }
 }
Exemplo n.º 19
0
 * 网站地址: http://www.douco.com
 * --------------------------------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在遵守授权协议前提下对程序代码进行修改和使用;不允许对程序代码以任何形式任何目的的再发布。
 * 授权协议:http://www.douco.com/license.html
 * --------------------------------------------------------------------------------------------------
 * Author: DouCo
 * Release Date: 2014-06-05
 */
define('ROUTE', true);
// 获取和方向标值
$route = $_REQUEST['route'];
$parts = explode('/', $route);
$site_path = str_replace('include/route.php', '', str_replace('\\', '/', __FILE__));
$root_url = str_replace('include', '', dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
// 方向标函数生成系统模块关键值
$mark = seo_url($route, $parts);
// 方向标
if (is_array($mark)) {
    foreach ($mark as $key => $value) {
        if ($value) {
            $_REQUEST[$key] = $value;
        }
    }
    $site_path . $mark['module'] . '.php';
    require $site_path . $mark['module'] . '.php';
} else {
    header("Location: " . $root_url);
}
/**
 * +----------------------------------------------------------
 * 方向标
Exemplo n.º 20
0
 function update_slideshow($id)
 {
     if ($_FILES['image']['name']) {
         $image = $this->load_image_name($this->input->post('id'));
         unlink('upload/slideshow/' . $image);
         $config['upload_path'] = get_config_value('upload_slideshow_path');
         $config['allowed_types'] = 'gif|jpg|jpeg|png';
         $config['max_size'] = get_config_value('max_size');
         $config['encrypt_name'] = TRUE;
         // rename to random string
         $this->load->library('upload', $config);
         if ($this->upload->do_upload('image')) {
             $datax = $this->upload->data();
             $this->db->set('image', $datax['file_name']);
         } else {
             print_r($this->upload->display_errors());
             exit;
         }
     }
     $this->db->set('title', $this->input->post('title'));
     $this->db->set('alias', seo_url($this->input->post('title')));
     $this->db->set('link_path', $this->input->post('link_path'));
     $this->db->where('id', $id);
     $result = $this->db->update('slideshow');
     return $result;
 }
Exemplo n.º 21
0
            echo base_url();
            ?>
thumbnail/timthumb.php?src=<?php 
            echo base_url();
            ?>
upload/deal/<?php 
            echo $rows->image1;
            ?>
&h=113&w=220&q=80" alt=""/>
                </a>
            </div>
            <p class="titlePro"><a href="<?php 
            echo base_url() . index_page();
            ?>
sugarshop/detail/<?php 
            echo $rows->id . "/" . seo_url($rows->name);
            ?>
.html"><?php 
            echo $rows->name;
            ?>
</a></p>
            <div class="contentPro clearfix">
            <div class="contentPro-l f-l"> <span class="values">Værdi</span> <span class="price"><?php 
            echo $rows->old_price;
            ?>
, - </span> </div>

            <div class="contentPro-r f-r"> <span class="values">Sugar medlems pris</span> <span class="price2"><?php 
            echo $rows->new_price;
            ?>
, -</span> </div>
Exemplo n.º 22
0
function albums_theme_main($area, $category)
{
    //Only show category listing if category = null
    if ($category == null) {
        $albums = albums_get_albums();
        if ($albums != FALSE) {
            //Loop through dirs.
            foreach ($albums as $album) {
                include ALBUMS_DIR . '/' . $album['seoname'] . '.php';
                //Find the first image.
                $files = read_dir_contents(ALBUMS_DIR . '/' . $album['seoname'], 'files');
                //Only display album if it contains images.
                if (!empty($files)) {
                    natcasesort($files);
                    foreach ($files as $file) {
                        $parts = explode('.', $file);
                        if (count($parts) == 4) {
                            list($number, $fdirname, $ext, $php) = $parts;
                            $first_image = $fdirname . '.' . $ext;
                            break;
                        }
                    }
                    unset($file);
                    ?>
					<div class="album">
						<table>
							<tr>
								<td>
									<a href="<?php 
                    echo SITE_URL . '/' . PAGE_URL_PREFIX . CURRENT_PAGE_SEONAME . ALBUM_URL_PREFIX . $album['seoname'];
                    ?>
" title="album <?php 
                    echo $album['title'];
                    ?>
">
										<img alt="<?php 
                    echo $album['title'];
                    ?>
" title="<?php 
                    echo $album['title'];
                    ?>
" src="<?php 
                    echo SITE_URL;
                    ?>
/data/modules/albums/albums_getimage.php?image=<?php 
                    echo $album['seoname'];
                    ?>
/thumb/<?php 
                    echo $first_image;
                    ?>
" />
									</a>
								</td>
								<td>
									<span class="albuminfo">
										<a href="<?php 
                    echo SITE_URL . '/' . PAGE_URL_PREFIX . CURRENT_PAGE_SEONAME . ALBUM_URL_PREFIX . $album['seoname'];
                    ?>
" title="<?php 
                    echo $album['title'];
                    ?>
"><?php 
                    echo $album['title'];
                    ?>
</a>
									</span>
								</td>
							</tr>
						</table>
					</div>
					<?php 
                }
            }
            unset($albums);
        }
    } else {
        albums_site_show_images(seo_url($category));
    }
}
Exemplo n.º 23
0
                                            <div class="question-mark2" style="float:left; margin: 0 3px;">
                                                <img alt="" src="<?php 
        echo base_url() . 'thumbnail/timthumb.php?src=' . base_url() . get_config_value('upload_deal_category_path') . $white_icon . '&q=100&w=33&h=33';
        ?>
" style="float:left;"/>
                                                <div class="common-popup">
                                                    <div class="top"><span class="arrow"></span></div>
                                                    <div class="content">
                                                        <?php 
        if ($dealID) {
            ?>
                                                        <a style="color: #ffffff; font-size: 13px;" href="<?php 
            echo base_url() . index_page();
            ?>
sugarshop/detail/<?php 
            echo $dealID . "/" . seo_url($dealName);
            ?>
.html"><?php 
            echo $dealName;
            ?>
</a>
                                                        <?php 
        } else {
            ?>
                                                            <p style="color: #ffffff; font-size: 13px;"><?php 
            echo $dealName;
            ?>
</p>
                                                        <?php 
        }
        ?>
Exemplo n.º 24
0
        <h3>Min indkøbs kurv</h3>
        <div class="w168 f-l">valgt</div>
        <div class="w65 f-l">stk</div>
        <div class="w65 f-l">sugar</div>
        <div class="w65 f-l">pris</div>
    </div>
    <?php 
if ($cart) {
    foreach ($cart as $rows) {
        ?>
    <div class="clearfix bor-b2 p10">
        <div class="w168 f-l"><a href="<?php 
        echo base_url() . index_page();
        ?>
sugarshop/detail/<?php 
        echo $rows['id'] . "/" . seo_url($rows['name']);
        ?>
.html">
            <img class="m-l10" src="<?php 
        echo base_url();
        ?>
thumbnail/timthumb.php?src=<?php 
        echo base_url();
        ?>
upload/deal/<?php 
        echo $rows['image'];
        ?>
&h=39&w=39&q=100" alt=""/>
        </a>
            <p><?php 
        echo $rows['name'];
Exemplo n.º 25
0
 * 版权所有 2013-2015 漳州豆壳网络科技有限公司,并保留所有权利。
 * 网站地址: http://www.douco.com
 * --------------------------------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在遵守授权协议前提下对程序代码进行修改和使用;不允许对程序代码以任何形式任何目的的再发布。
 * 授权协议:http://www.douco.com/license.html
 * --------------------------------------------------------------------------------------------------
 * Author: DouCo
 * Release Date: 2015-10-16
 */
define('ROUTE', true);
// 获取伪静态后的URL
$route = $_REQUEST['route'];
$site_path = str_replace('include/route.php', '', str_replace('\\', '/', __FILE__));
$root_url = str_replace('include', '', dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
// 格式化URL
$mark = seo_url($route);
if (is_array($mark)) {
    // 将关键数据赋值到$_REQUEST
    foreach ($mark as $key => $value) {
        if ($value) {
            $_REQUEST[$key] = $value;
        }
    }
    // 根据URL加载对应的PHP文件
    require $site_path . $mark['module'] . '.php';
} else {
    header("Location: " . $root_url);
    exit;
}
/**
 * +----------------------------------------------------------
Exemplo n.º 26
0
 function update_dating()
 {
     $user = getUser();
     $hour = $this->input->post('hour');
     $minute = $this->input->post('minute');
     $date = $this->input->post('date');
     $vipid = $this->input->post('vipid');
     $tmp = explode("-", $date);
     $end_date = mktime($hour, $minute, 0, $tmp[1], $tmp[0], $tmp[2]);
     $this->db->set('user_id', $user->id);
     $this->db->set('title', $this->input->post('title'));
     $this->db->set('alias', seo_url($this->input->post('title')));
     //$this->db->set('order_item_id', $this->input->post('order_item_id'));
     $this->db->set('end_date', $end_date);
     $this->db->set('description', $this->input->post('description'));
     if ($vipid) {
         $this->db->set('publish', 0);
         $this->db->set('uservip', $vipid);
         $this->db->set('timevip', time());
     } else {
         $this->db->set('publish', 1);
     }
     $this->db->where('id', $this->input->post('id'));
     $result = $this->db->update('dating');
     return $result;
 }
Exemplo n.º 27
0
?>
</div>
                <div style="padding-bottom: 10px;">
                    <?php 
echo $deals->description;
?>
                </div>
            </div>
            <div class="w159 f-r">
              <div class="btn-share-social">
              	<p>Del produktet på</p>
   	                <a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php 
echo base_url() . index_page();
?>
sugarshop/detail/<?php 
echo $deals->id . "/" . seo_url($deals->name);
?>
.html">
                        <img src="<?php 
echo base_url();
?>
assets/frontend/img/btn-fb-share.png" alt="" title="facebook"/>
                    </a>
              </div>
              <div class="valueSale clearfix">
                <div class="f-l">
                  <label>Værdi</label>
                  <p><?php 
echo priceFormat($deals->old_price);
?>
</p>
Exemplo n.º 28
0
 function update_category($data)
 {
     $this->db->trans_start();
     $config['upload_path'] = $this->config->item('category_file_location');
     $config['allowed_types'] = 'gif|jpg|jpeg|png';
     $config['max_size'] = $this->config->item('max_image_size');
     $config['encrypt_name'] = TRUE;
     // rename to random string
     if ($_FILES['userfile']['name']) {
         $this->load->library('upload', $config);
         if ($this->upload->do_upload()) {
             $datax = $this->upload->data();
             $this->db->set('icon', $datax['file_name']);
         } else {
             return -1;
         }
     }
     $this->db->set('sort_order', $data['sorting']);
     $this->db->where('category_id', $data['id']);
     $this->db->update('category');
     $arr['seo'] = seo_url($data['name']);
     // load from helper
     $this->db->set('name', $data['name']);
     //$this->db->set('name_alias',$arr['seo']);
     $this->db->set('info', $data['maincontent']);
     $this->db->where('category_id', $data['id']);
     $this->db->update('category_description');
     $this->db->trans_complete();
     // end TRANSACTION
     if ($this->db->trans_status() == FALSE) {
         return 0;
     } else {
         return 1;
     }
 }