예제 #1
0
 public function comments($image_id)
 {
     $image = $this->db->select('title')->from('nf_gallery_images')->where('image_id', $image_id)->row();
     if ($image) {
         return array('title' => $image, 'url' => 'gallery/image/' . $image_id . '/' . url_title($image) . '.html');
     }
 }
예제 #2
0
 /**
  * Process Post
  *
  * Process data that was not part of the 
  * initial streams call.
  *
  * @return 	void
  */
 public function process_post(&$post)
 {
     $this->load->helper('text');
     // Keywords array
     /*$keywords = Keywords::get($post->keywords);
     		$formatted_keywords = array();
     		$keywords_arr = array();
     
     		foreach ($keywords as $key)
     		{
     			$formatted_keywords[] 	= array('keyword' => $key->name);
     			$keywords_arr[] 		= $key->name;
     
     		}
     		$post->keywords = $formatted_keywords;
     		$post->keywords_arr = $keywords_arr;*/
     // Full URL for convenience.
     //$post->url = site_url('kasus/'.date('Y/m/d', $post->created_on).'/'.$post->slug);
     $slug = url_title($post->title, 'dash', TRUE);
     $post->url = site_url('kasus/' . date('Y/m/d', strtotime($post->created_on)) . '/' . $slug);
     // What is the preview? If there is a field called intro,
     // we will use that, otherwise we will cut down the news post itself.
     //$post->preview = (isset($post->intro)) ? $post->intro : $post->body;
     // Category
     /*if ($post->category_id > 0 and isset($this->categories[$post->category_id]))
     		{
     			$post->category = $this->categories[$post->category_id];
     		}*/
 }
예제 #3
0
 /**
  * @author : Gede Lumbung
  * @web : http://gedelumbung.com
  **/
 function index($title = "", $uri = 0)
 {
     if ($this->session->userdata('logged_in') != "") {
         $id_param = $this->session->userdata("id_member");
         $d['left_top_menu'] = $this->app_global_web_model->generate_menu("kiri", "nav pull-left");
         $d['right_top_menu'] = $this->app_global_web_model->generate_menu("kanan", "nav pull-right");
         $d['center_bottom_menu'] = $this->app_global_web_model->generate_menu("footer");
         $d['combo_lokasi'] = $this->app_global_web_model->generate_combo_lokasi();
         $d['combo_kategori'] = $this->app_global_web_model->generate_combo_kategori();
         $d['list_kategori'] = $this->app_global_web_model->generate_list_kategori("nav nav-list");
         $d['left_artikel_hot'] = $this->app_global_web_model->generate_front_artikel($_SESSION['site_limit_artikel_hot'], 0, "counter", 1);
         $d['left_iklan_hot'] = $this->app_global_web_model->generate_list_iklan($_SESSION['site_limit_sidebar'], "counter");
         $d['left_iklan_new'] = $this->app_global_web_model->generate_list_iklan($_SESSION['site_limit_sidebar'], "id_iklan");
         $where['id_member'] = $id_param;
         $gen_menu = $this->db->get_where("dlmbg_member", $where);
         if ($gen_menu->num_rows() == 0) {
             redirect(base_url());
         }
         $menu_crumb = $gen_menu->row();
         $this->breadcrumb->append_crumb('BERANDA', base_url());
         $this->breadcrumb->append_crumb('DASHBOARD', base_url() . 'user/dashboard');
         $this->breadcrumb->append_crumb(strtoupper($menu_crumb->nama), base_url() . 'web/kategori/get/' . $id_param . '/' . url_title($menu_crumb->nama, '-', TRUE));
         $d['dt_retrieve'] = $this->app_user_web_model->generate_detail_member($id_param, $_SESSION['site_limit_iklan_kategori'], $uri);
         $this->load->view($_SESSION['site_theme'] . '/bg_header', $d);
         $this->load->view($_SESSION['site_theme'] . '/user/dashboard/bg_home');
         $this->load->view($_SESSION['site_theme'] . '/bg_left');
         $this->load->view($_SESSION['site_theme'] . '/bg_footer');
     } else {
         redirect(base_url());
     }
 }
예제 #4
0
파일: ajax.php 프로젝트: notjosh/seaforium
 /**
  * New Comment Notification
  *
  * Javascript calls this every few seconds to check
  * on the existence of new comments
  *
  * @access	public
  * @param	int		thread id
  * @param	int		current number of comments
  * @return	void
  */
 function thread_notifier($thread_id = 0, $current_count = 0)
 {
     // make sure thread_id and current_count are integers
     $thread_id = (int) $thread_id;
     $current_count = (int) $current_count;
     // the typecasting above will convert non-integers to zero
     if ($thread_id === 0 || $current_count === 0) {
         return;
     }
     // find out how many comments are in the thread
     $thread_info = $this->thread_dal->comment_count_info($thread_id);
     $db_count = $thread_info->max_rows;
     // handle JSON, otherwise fail through to HTML output
     if ($this->is_request_json()) {
         return send_json($this->output, 200, array('thread_id' => $thread_id, 'comment_count' => $db_count, 'new_comment_count' => $db_count - $current_count));
     }
     // if the numbers dont match, throw out some html
     if ($db_count > $current_count) {
         // number of new posts
         $new_posts = $db_count - $current_count;
         $title = url_title($thread_info->subject, 'dash', TRUE);
         $shown = $this->session->userdata('comments_shown');
         if (!$shown) {
             $shown = 25;
         }
         $count = (ceil($db_count / $shown) - 1) * $shown;
         echo '<div id="notifier"><a id="notify" href="/thread/' . $thread_id . '/' . $title . '/p/' . $count . '/r' . mt_rand(10000, 99999) . '#bottom">' . $new_posts . ' new post' . ($new_posts === 1 ? '' : 's') . " added</a></div>";
     }
 }
예제 #5
0
 public function test_url_title_extra_dashes()
 {
     $words = array('_foo bar_' => 'foo_bar', '_What\'s wrong with CSS?_' => 'Whats_wrong_with_CSS');
     foreach ($words as $in => $out) {
         $this->assertEquals($out, url_title($in, 'underscore'));
     }
 }
예제 #6
0
 public function parse()
 {
     $tmpname = wp_unique_filename($this->targetDir, str_replace("sql", "xml", basename($this->_filename)));
     $this->xml_path = $this->targetDir . '/' . url_title($tmpname);
     $this->toXML();
     return $this->xml_path;
 }
	public function Create_url_title($tagdata = '')
	{
		$this->EE = get_instance();
		
		$this->EE->load->helper('url');
		
		$separator = NULL;
		
		if (in_array($this->EE->TMPL->fetch_param('separator'), array('dash', '-')))
		{
			$separator = 'dash';
		}
		elseif ($this->EE->TMPL->fetch_param('separator') == '_')
		{
			$separator = '_';
		}
		else
		{
			$separator = $this->EE->config->item('word_separator');
		}
		
		if (func_num_args() === 0)
		{
			$tagdata = $this->EE->TMPL->tagdata;
		}
		
		$this->return_data = url_title(
			trim($tagdata),
			$separator,
			(preg_match('/0|no|off|n/i', $this->EE->TMPL->fetch_param('lowercase'))) ? FALSE : TRUE
		);
	}
예제 #8
0
 public function getfrom404()
 {
     $istem = parse_url($_SERVER['REQUEST_URI']);
     $this->output->set_header("HTTP/1.0 200 OK");
     $this->output->set_header("HTTP/1.1 200 OK");
     $istem = parse_url($_SERVER['REQUEST_URI']);
     $i = $istem['path'];
     $flag404 = TRUE;
     $d = explode("/", $i, -1);
     $id = '';
     foreach ($d as $k) {
         if (strlen($k) > 2) {
             redirect();
         }
         //Direkt ID ile içerik çekilmesi engelleniyor. Parçalar 2 şer harften büyük olamaz.
         if ($k == '') {
             continue;
         }
         $k = is_numeric($k) ? $k : '00';
         $id .= $k;
     }
     if ($id < 1) {
         redirect();
     }
     $person = $this->db->select('id,name')->from('liste')->where('id', $id)->limit('1')->get()->row();
     if (!isset($person->id) || $person->id < 1) {
         redirect();
     }
     redirect(base_url() . 'face/get/' . genid_from_id($person->id) . '/' . url_title($person->name), 'location', 301);
 }
예제 #9
0
 public function add($id = NULL)
 {
     $data = array();
     if ($id !== NULL) {
         $data = $this->mongo_db->page->findOne(array('_id' => new MongoID($id)));
         if (!count($data)) {
             show_404();
         }
     }
     $this->load->library(array('form_validation'));
     $this->form_validation->set_rules('title', 'Sayfa Başlığı', 'trim|required');
     $this->form_validation->set_rules('content', 'Sayfa İçeriği', 'required');
     if ($this->form_validation->run()) {
         $sql_data = array('slug' => url_title($this->form_validation->set_value('title')), 'author' => $this->session->userdata('user_id'), 'title' => $this->form_validation->set_value('title'), 'content' => $this->form_validation->set_value('content'), 'meta_title' => $this->input->post('meta_title'), 'meta_description' => $this->input->post('meta_description'), 'meta_keyword' => $this->input->post('meta_keyword'), 'created_at' => isset($data['created_at']) ? $data['created_at'] : new MongoDate(), 'updated_at' => new MongoDate());
         if ($id !== NULL) {
             $sql_data['_id'] = new MongoID($id);
         }
         $sql_data = array_merge($data, $sql_data);
         $this->mongo_db->page->ensureIndex('slug');
         $this->mongo_db->page->save($sql_data);
         if (isset($data['slug']) && $data['slug'] != $sql_data['slug']) {
             $redirect = array('old_slug' => $data['slug'], 'new_slug' => $sql_data['slug'], 'module' => 'page');
             $this->mongo_db->redirect->save($redirect);
         }
         if ($id === NULL) {
             flash_message('success', 'Sayfa başarıyla eklendi.');
         } else {
             flash_message('success', 'Sayfa başarıyla düzenlendi.');
         }
         redirect('admin/page/index');
     }
     $this->template->view('admin/add', $data)->render();
 }
예제 #10
0
 /**
  *  Admin CRUD
  */
 public function main_form($form_type, $url = null)
 {
     if ($this->input->post('url')) {
         $_POST['url'] = url_title($this->input->post('url'), 'dash', TRUE);
     }
     $this->load->helper(array('form', 'url'));
     $this->load->library('form_validation');
     if ($form_type == 'edit_sidebar') {
         $this->form_validation->set_rules('title', 'Title', 'trim|required|callback_be_unique');
     } else {
         $this->form_validation->set_rules('title', 'Title', 'trim|required');
     }
     $this->form_validation->set_rules('url', 'URL', 'trim|required|callback_be_unique');
     $this->form_validation->set_error_delimiters('<li>', '</li>');
     if ($this->form_validation->run() == FALSE) {
         return false;
     } else {
         if ($form_type == 'new') {
             //                $this->new_user();
         }
         if ($form_type == 'edit' || $form_type == 'edit_sidebar') {
             $this->update_page($url);
         }
         return true;
     }
 }
예제 #11
0
 function get($id_param, $title = "", $uri = 0)
 {
     $d['left_top_menu'] = $this->app_global_web_model->generate_menu("kiri", "nav pull-left");
     $d['right_top_menu'] = $this->app_global_web_model->generate_menu("kanan", "nav pull-right");
     $d['center_bottom_menu'] = $this->app_global_web_model->generate_menu("footer");
     $d['combo_lokasi'] = $this->app_global_web_model->generate_combo_lokasi();
     $d['combo_kategori'] = $this->app_global_web_model->generate_combo_kategori();
     $d['list_kategori'] = $this->app_global_web_model->generate_list_kategori("nav nav-list");
     $d['left_artikel_hot'] = $this->app_global_web_model->generate_front_artikel($_SESSION['site_limit_artikel_hot'], 0, "counter", 1);
     $d['left_iklan_hot'] = $this->app_global_web_model->generate_list_iklan($_SESSION['site_limit_sidebar'], "counter");
     $d['left_iklan_new'] = $this->app_global_web_model->generate_list_iklan($_SESSION['site_limit_sidebar'], "id_iklan");
     $where['id_kategori'] = $id_param;
     $gen_menu = $this->db->get_where("dlmbg_kategori", $where);
     if ($gen_menu->num_rows() == 0) {
         redirect(base_url());
     }
     $menu_crumb = $gen_menu->row();
     $this->breadcrumb->append_crumb('BERANDA', base_url());
     $this->breadcrumb->append_crumb('KATEGORI', base_url() . 'web/kategori');
     $this->breadcrumb->append_crumb(strtoupper($menu_crumb->kategori), base_url() . 'web/kategori/get/' . $id_param . '/' . url_title($menu_crumb->kategori, '-', TRUE));
     $d['dt_retrieve'] = $this->app_global_web_model->generate_indexs_iklan_kategori($id_param, $_SESSION['site_limit_iklan_kategori'], $uri);
     $d['kategori_title'] = strtoupper($menu_crumb->kategori);
     $this->load->view($_SESSION['site_theme'] . '/bg_header', $d);
     $this->load->view($_SESSION['site_theme'] . '/kategori/bg_detail');
     $this->load->view($_SESSION['site_theme'] . '/bg_left');
     $this->load->view($_SESSION['site_theme'] . '/bg_footer');
 }
예제 #12
0
 /**
  * Get a count of all the comments for a given thread id
  *
  * @param	int
  * @param	int
  */
 private function get_comments($thread_id)
 {
     $sql = "SELECT\n\t\t\t\tSQL_CALC_FOUND_ROWS\n\t      comments.comment_id,\n\t      comments.content,\n\t      comments.original_content,\n\t      comments.created,\n\t      comments.deleted,\n\t      comments.user_id AS author_id,\n\t      users.username AS author_name,\n\t      users.banned AS author_banned,\n\t      users.emoticon,\n\t      IFNULL(acquaintances.type, 0) AS author_acquaintance_type\n\t    FROM comments\n\t    LEFT JOIN users\n\t      ON comments.user_id = users.id\n\t    LEFT JOIN acquaintances\n\t      ON acquaintances.acq_user_id = users.id\n\t      AND acquaintances.user_id = ?\n\t    WHERE comments.thread_id = ?\n\t    ORDER BY comments.created\n\t    LIMIT ?, ?";
     $result = $this->db->query($sql, array($this->meta['user_id'], $thread_id, $this->page, $this->meta['comments_shown']));
     if (!$result->num_rows()) {
         return NULL;
     } else {
         $return = array();
         $i = 0;
         foreach ($result->result() as $row) {
             if ($row->deleted == '0') {
                 $return[$i] = (object) array('comment_id' => $row->comment_id, 'content' => $row->content, 'created' => strtotime($row->created), 'deleted' => 0, 'author_id' => (int) $row->author_id, 'author_name' => $row->author_name, 'author_banned' => (bool) $row->author_banned, 'url_safe_author_name' => url_title($row->author_name, 'dash'), 'emoticon' => (bool) $row->emoticon, 'author_acquaintance_type' => (int) $row->author_acquaintance_type, 'author_acquaintance_name' => $row->author_acquaintance_type == 1 ? 'buddy' : ($row->author_acquaintance_type == 2 ? 'enemy' : NULL), 'owner' => $this->meta['user_id'] == $row->author_id, 'editable' => $this->meta['user_id'] == $row->author_id && $row->created < time() - 60 * 60 * 24, 'show_controls' => $this->page == 0 && $this->meta['user_id'] == $row->author_id && !$i);
                 // update comments if the content doesnt match original
                 if ($row->content === '' && $row->content == _process_post($row->original_content)) {
                     $return[$i]->content = _process_post($row->original_content);
                     $this->db->query("UPDATE comments SET content = ? WHERE comment_id = ?", array($return[$i]->content, $row->comment_id));
                 }
                 if ($return[$i]->author_acquaintance_type == 2) {
                     ++$this->return->information->enemies;
                 }
             } else {
                 $return[$i] = (object) array('comment_id' => (int) $row->comment_id, 'created' => $row->created, 'deleted' => 1);
             }
             ++$i;
         }
         return $return;
     }
 }
예제 #13
0
 public function update_cms($array)
 {
     if (isset($array['cms_name'])) {
         $this->db->set('cms_name', $array['cms_name']);
         // prepend the section if it is entered (added this way for backwards compatability)
         if (isset($array['site_section'])) {
             $this->db->set('cms_url', url_title($array['site_section']) . "_" . url_title($array['cms_name']));
         } else {
             $this->db->set('cms_url', url_title($array['cms_name']));
         }
     }
     if (isset($array['cms_text'])) {
         $this->db->set('cms_text', $array['cms_text']);
     }
     if (isset($array['custom_1'])) {
         $this->db->set('custom_1', $array['custom_1']);
     }
     if (isset($array['custom_2'])) {
         $this->db->set('custom_2', $array['custom_2']);
     }
     if (isset($array['site_section'])) {
         $this->db->set('site_section', $array['site_section']);
     }
     $this->db->where('cms_id', $array['cms_id']);
     $this->db->update('cms');
     log_message('debug', "updateCMS:" . trim($this->db->last_query()));
     return $this->db->affected_rows();
 }
예제 #14
0
파일: admin.php 프로젝트: BenneX/pyrocms
 function edit($id = 0)
 {
     if (!$id) {
         redirect('admin/news/index');
     }
     $this->load->library('validation');
     $this->validation->set_rules($this->rules);
     $this->validation->set_fields();
     $article = $this->news_m->getArticle($id, 'all');
     if ($this->validation->run()) {
         if ($this->news_m->updateArticle($_POST, $id)) {
             $this->session->set_flashdata(array('success' => 'The article "' . $this->input->post('title') . '" was updated.'));
             // The twitter module is here, and enabled!
             if ($this->settings->item('twitter_news') == 1 && ($article->status != 'live' && $this->input->post('status') == 'live')) {
                 $url = shorten_url('news/' . $this->input->post('created_on_year') . '/' . str_pad($this->input->post('created_on_month'), 2, '0', STR_PAD_LEFT) . '/' . url_title($this->input->post('title')));
                 $this->load->module_model('twitter', 'twitter_m');
                 $this->twitter_m->update(sprintf('Posted "%s" %s', $this->input->post('title'), $url));
             }
             // End twitter code
         } else {
             $this->session->set_flashdata(array('error' => 'An error occurred.'));
         }
         redirect('admin/news/index');
     }
     // Go through all the known fields and get the post values
     foreach (array_keys($this->rules) as $field) {
         if (isset($_POST[$field])) {
             $article->{$field} = $this->validation->{$field};
         }
     }
     $this->data->article =& $article;
     // Load WYSIWYG editor
     $this->layout->extra_head($this->load->view('fragments/wysiwyg', $this->data, TRUE));
     $this->layout->create('admin/form', $this->data);
 }
예제 #15
0
 function insert_event_form()
 {
     if (isset($_POST['event_name'])) {
         $this->db->set('event_name', $_POST['event_name']);
         $this->db->set('event_url_name', url_title($_POST['event_name']));
     }
     if (isset($_POST['event_desc'])) {
         $this->db->set('event_desc', $_POST['event_desc']);
     }
     if (isset($_POST['event_desc_brief'])) {
         $this->db->set('event_desc_brief', $_POST['event_desc_brief']);
     }
     if (isset($_POST['event_type'])) {
         $this->db->set('event_type', $_POST['event_type']);
     }
     if (isset($_POST['event_avatar'])) {
         $this->db->set('event_avatar', $_POST['event_avatar']);
     }
     if (isset($_POST['event_date'])) {
         $this->db->set('event_date', $_POST['event_date']);
     }
     if (isset($_POST['location'])) {
         $this->db->set('location', $_POST['location']);
     }
     $this->db->insert('cn_events');
     log_message('debug', "EVENT:insertEvent:" . trim($this->db->last_query()));
     $event_id = $this->db->insert_id();
     return $event_id;
 }
예제 #16
0
 function on_before_clean($values)
 {
     if (empty($value['slug'])) {
         $values['slug'] = url_title($values['name'], 'dash', TRUE);
     }
     return $values;
 }
예제 #17
0
 function update()
 {
     // var_dump($this->input->post('dtanggal_lahir'));
     // exit();
     $config = array('allowed_types' => 'jpg|jpeg|gif|png', 'upload_path' => $this->gallery_path, 'max_size' => 2000, 'file_name' => url_title($this->input->post('userfile')));
     $this->load->library('upload', $config);
     $this->upload->initialize($config);
     //meng set config yang sudah di atur
     if (!$this->upload->do_upload('userfile')) {
         $id_admin = $this->input->post('id_admin');
         $data = array('username' => $this->input->post('dusername'), 'password' => $this->input->post('dpassword'), 'nama_depan' => $this->input->post('dnama_depan'), 'nama_belakang' => $this->input->post('dnama_belakang'), 'nama_panggilan' => $this->input->post('dnama_panggilan'), 'jk' => $this->input->post('djk'), 'agama' => $this->input->post('dagama'), 'tempat_lahir' => $this->input->post('dtempat_lahir'), 'tanggal_lahir' => $this->input->post('dtanggal_lahir'), 'email' => $this->input->post('demail'), 'no_hp' => $this->input->post('dno_hp'), 'alamat' => $this->input->post('dalamat'));
         $this->m_profile_admin->update($id_admin, $data);
         echo "<script>alert('Data berhasil di ubah!');</script>";
         redirect('admin/c_profile_admin', 'refresh');
     } else {
         $id_guru = $this->input->post('did_guru');
         $map = $_SERVER['DOCUMENT_ROOT'];
         $path = $map . '/pengolahannilai/images/';
         $nama_photo = $this->input->post('gambar_dlt');
         $image = $path . $nama_photo;
         //hapus image
         unlink($image);
         $data = array('username' => $this->input->post('dusername'), 'password' => $this->input->post('dpassword'), 'nama_depan' => $this->input->post('dnama_depan'), 'nama_belakang' => $this->input->post('dnama_belakang'), 'nama_panggilan' => $this->input->post('dnama_panggilan'), 'jk' => $this->input->post('djk'), 'agama' => $this->input->post('dagama'), 'tempat_lahir' => $this->input->post('dtempat_lahir'), 'tanggal_lahir' => $this->input->post('dtanggal_lahir'), 'email' => $this->input->post('demail'), 'no_hp' => $this->input->post('dno_hp'), 'alamat' => $this->input->post('dalamat'), 'photo' => $this->upload->file_name);
         $this->m_profile_admin->update($id_guru, $data);
         echo "<script>alert('Data berhasil di ubah!');</script>";
         redirect('admin/c_profile_admin', 'refresh');
     }
 }
예제 #18
0
 function on_before_clean($values)
 {
     if (empty($values['permalink']) && !empty($values['name'])) {
         $values['permalink'] = url_title($values['name'], 'dash', TRUE);
     }
     return $values;
 }
예제 #19
0
파일: cms.php 프로젝트: affanus/new_app
 function addpage_()
 {
     $data['headingtop'] = 'CMS > Manage Pages > Add Page';
     $data['title'] = 'Add Page';
     $this->load->library('form_validation');
     // field name, error message, validation rules
     $this->form_validation->set_rules('title', 'Title', 'trim|required');
     if ($this->form_validation->run() == FALSE) {
         $this->load->library('ckeditor', base_url() . 'system/plugins/ckeditor/');
         $this->ckeditor->basePath = base_url() . 'system/plugins/ckeditor/';
         $this->ckeditor->ToolbarSet = 'Basic';
         $data['errormess'] = '1';
         $data['main_content'] = 'admin/cms/addpage';
         $this->load->view('admin/template', $data);
     } else {
         $title = addslashes($this->input->post('title'));
         $content = addslashes($this->input->post('editor1'));
         $url = url_title($title);
         $query = $this->db->query("Select * From tblpages WHERE pagename = '{$url}'");
         if ($query->num_rows() != 0) {
             $hash = rand(1, 1000);
             $url = $url . $hash;
         }
         $data['errormess'] = '';
         $data = array('title' => $title, 'parent' => $this->input->post('parent'), 'position' => $this->input->post('position'), 'isActive' => $this->input->post('isactive'), 'ispublic' => $this->input->post('ispublic'), 'seqno' => $this->input->post('seqno'), 'content' => $content, 'pagename' => $url, 'meta_title' => addslashes($this->input->post('meta_title')), 'meta_keywords' => addslashes($this->input->post('meta_keywords')), 'meta_decrip' => addslashes($this->input->post('meta_decrip')));
         $this->db->insert('tblpages', $data);
         redirect(base_url() . 'admin/cms/', 'refresh');
     }
 }
예제 #20
0
 function update($id)
 {
     $data = array('title' => $this->input->post('title'), 'permalink' => url_title(strtolower($this->input->post('title'))), 'body' => $this->input->post('body'), 'status' => $this->input->post('status'), 'modified' => date('Y-m-d H:i:s'));
     $this->db->where('id', $id);
     $this->db->update($this->table, $data);
     return TRUE;
 }
예제 #21
0
 public function get_user_info(OAuth2_Token_Access $token)
 {
     $url = 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json&' . http_build_query(array('access_token' => $token->access_token));
     $user = json_decode(dr_catcher_data($url), true);
     // ����ͳһ����ݸ�ʽ
     return array('oid' => $user['id'], 'oauth' => 'google', 'avatar' => isset($user['picture']) ? $user['picture'] : null, 'nickname' => url_title($user['name'], '_', true), 'expire_at' => $token->expires, 'access_token' => $token->access_token, 'refresh_token' => $token->refresh_token);
 }
예제 #22
0
 function ubah()
 {
     $id = $this->input->post('id_gallery');
     $config = array('allowed_types' => 'jpg|jpeg|gif|png', 'upload_path' => $this->gallery_path, 'max_size' => 2000, 'file_name' => url_title($this->input->post('userfile')));
     $this->load->library('upload', $config);
     $this->upload->initialize($config);
     //meng set config yang sudah di atur
     if (!$this->upload->do_upload('userfile')) {
         $data = array('caption' => $this->input->post('caption'), 'id_provinsi' => $this->input->post('id_provinsi'));
         $exe = $this->db->where('id_gallery', $id);
         $exe = $this->db->update('tb_gallery', $data);
         return true;
     } else {
         $id_gallery = $this->input->post('id_gallery');
         $map = $_SERVER['DOCUMENT_ROOT'];
         $path = $map . '' . base_url() . 'images/gallery/';
         $nama_photo = $this->input->post('photo');
         $image = $path . $nama_photo;
         unlink($image);
         $data = array('caption' => $this->input->post('caption'), 'image' => $this->upload->file_name, 'id_provinsi' => $this->input->post('id_provinsi'));
         $exe = $this->db->where('id_gallery', $id);
         $exe = $this->db->update('tb_gallery', $data);
         return true;
     }
 }
예제 #23
0
 public function get_user_info(OAuth2_Token_Access $token)
 {
     $url = 'https://identity.x.com/xidentity/resources/profile/me?' . http_build_query(array('oauth_token' => $token->access_token));
     $user = json_decode(file_get_contents($url));
     $user = $user->identity;
     return array('uid' => $user['userId'], 'nickname' => url_title($user['fullName'], '_', true), 'name' => $user['fullName'], 'first_name' => $user['firstName'], 'last_name' => $user['lastName'], 'email' => $user['emails'][0], 'location' => $user->addresses[0], 'image' => null, 'description' => null, 'urls' => array('PayPal' => null));
 }
예제 #24
0
파일: posts.php 프로젝트: herry88/sekolahku
 function edit($id = null)
 {
     if ($id == null) {
         $id = $this->input->post('id');
     }
     $this->form_validation->set_rules('title', 'title', 'required|xss_clean');
     $this->form_validation->set_rules('body', 'body', 'required|xss_clean');
     $this->form_validation->set_rules('categories_id', 'category', 'required|xss_clean');
     $this->form_validation->set_rules('status', 'status', 'required|xss_clean');
     $this->form_validation->set_error_delimiters('', '<br/>');
     if ($this->form_validation->run() == TRUE) {
         $params = array('title' => $this->input->post('title'), 'permalink' => url_title($this->input->post('title')), 'body' => $this->input->post('body'), 'categories_id' => $this->input->post('categories_id'), 'status' => $this->input->post('status'), 'users_id' => $this->session->userdata('id'), 'created' => date("Y-m-d H:i:s"));
         if ($_FILES['image']['error'] != 4) {
             $config['upload_path'] = $this->imagePath;
             $config['allowed_types'] = 'jpg|png|jpeg|gif';
             $config['max_size'] = '200000';
             $this->load->library('upload', $config);
             if ($this->upload->do_upload("image")) {
                 $image = $this->upload->data();
                 $params['image'] = $this->imagePath . $image['file_name'];
             }
         }
         $this->Posts_model->update($id, $params);
         $this->session->set_flashdata('success', 'Post edited');
         redirect('admin/posts');
     }
     $data['post'] = $this->Posts_model->findById($id);
     $data['categories'] = $this->Categories_model->findList();
     $data['status'] = $this->status;
     $data['content'] = 'admin/posts/edit';
     $this->load->view($this->template, $data);
 }
예제 #25
0
 function insert_article()
 {
     //print_r($this->input->post());die;
     // To create the nested structure, the $recursive parameter
     // to mkdir() must be specified.
     $structure = './uploads/articles/images';
     if (!file_exists($structure)) {
         if (!mkdir($structure, 0777, true)) {
             die('Failed to create folders...');
         }
     }
     //insert home page slider information
     $config['upload_path'] = './uploads/articles/images/';
     $config['allowed_types'] = 'gif|jpg|png|jpeg';
     $config['encrypt_name'] = TRUE;
     $this->load->library('upload');
     $this->upload->initialize($config);
     $this->upload->do_upload('image');
     $file_data = $this->upload->data();
     $keyword = $this->input->post('keywords');
     $data = array('article_name' => $this->input->post('article_name'), 'alias' => url_title($this->input->post('article_name'), 'dash', TRUE), 'short_desc' => $this->input->post('short_desc'), 'keywords' => $keyword, 'demo_link' => $this->input->post('demo_link'), 'download_path' => $this->input->post('download_url'), 'meta_tags' => $this->input->post('meta_tags'), 'detail_desc' => $this->input->post('detail_desc'), 'user_id' => $this->session->userdata('gblAdminId'), 'date_of_updated' => date('Y-m-d H:i:s'));
     if ($file_data['file_name'] != '') {
         $data['image'] = $file_data['file_name'];
     }
     if ($this->input->post('is_question')) {
         $data['is_question'] = 1;
     } else {
         $data['is_question'] = 0;
     }
     if ($this->input->post('authentication')) {
         $data['download_authentication'] = 1;
     } else {
         $data['download_authentication'] = 0;
     }
     if ($this->input->post('is_live')) {
         $data['is_live'] = 1;
     } else {
         $data['is_live'] = 0;
     }
     // insert and redirect page
     if ($this->input->post('action') == 'update') {
         $aid = $this->input->post('aid');
         $this->db->where('id', $aid);
         $this->db->update($this->db->dbprefix('articles'), $data);
         $last_insert_id = $aid;
         $this->db->where('article_id', $aid);
         $this->db->delete($this->db->dbprefix('keywords'));
     } else {
         $data['date_of_added'] = date('Y-m-d H:i:s');
         $this->db->insert($this->db->dbprefix('articles'), $data);
         $last_insert_id = $this->db->insert_id();
     }
     $keyword_array = explode(',', $keyword);
     foreach ($keyword_array as $keyword) {
         $this->insert_keyword($last_insert_id, $keyword);
         // insert keywords in keyword table
     }
     $this->session->set_flashdata('msg_ok', 'Article Created successfully.');
     redirect(site_url($this->uri->slash_segment(1) . $this->uri->slash_segment(2)));
 }
예제 #26
0
 public function updateproduct($id, $tablename, $image)
 {
     $pname = $this->input->post('pname');
     $data = array('product_name' => $this->input->post('pname'), 'product_description' => $this->input->post('pdescription'), 'product_image' => $image, 'shipping_detail' => $this->input->post('pdetails'), 'price' => $this->input->post('pprice'), 'rating' => $this->input->post('prating'), 'featured' => $this->input->post('feature'), 'publish' => $this->input->post('publish'), 'slug' => url_title($pname, 'dash', true), 'stock_info' => $this->input->post('pquantity'), 'cat_id' => $this->input->post('cat_title'));
     $this->db->where('product_id', $id);
     $this->db->update($tablename, $data);
 }
예제 #27
0
 function update_page($page, $prevpage)
 {
     $file_content = "";
     // we don't want to save parent data
     $parent = $page['parent'];
     unset($page['parent']);
     // set content
     foreach ($page as $key => $value) {
         if ($value) {
             if ($key == 'slug') {
                 $file_content .= "{: " . $key . " :} " . strtolower(url_title($value)) . "\n";
             } else {
                 $file_content .= "{: " . $key . " :} " . $value . "\n";
             }
         }
     }
     // move page
     $this->pusaka->move_page($prevpage['slug'], $page['slug'], $prevpage['parent'], $parent);
     // update page content
     if (write_file(PAGE_FOLDER . $parent . '/' . $page['slug'] . '.md', $file_content, 'w+')) {
         $this->pusaka->sync_page();
         return true;
     } else {
         return false;
     }
 }
예제 #28
0
 public function comments($news_id)
 {
     $news = $this->db->select('title')->from('nf_news_lang')->where('news_id', $news_id)->where('lang', $this->config->lang)->row();
     if ($news) {
         return array('title' => $news, 'url' => 'news/' . $news_id . '/' . url_title($news) . '.html');
     }
 }
예제 #29
0
 public function set_news()
 {
     $this->load->helper('url');
     $slug = url_title($this->input->post('title'), 'dash', TRUE);
     $data = array('title' => $this->input->post('title'), 'slug' => $slug, 'text' => $this->input->post('text'));
     return $this->db->insert('news', $data);
 }
예제 #30
0
파일: Post.php 프로젝트: gieart87/ci-blog
 function update($post, $id)
 {
     $post['slug'] = url_title($post['title'], '-', true);
     $post['body'] = trim(preg_replace('/\\s\\s+/', ' ', $post['body']));
     $this->db->where('id', $id);
     $this->db->update($this->table, $post);
 }