예제 #1
0
파일: Items.php 프로젝트: andrel/selfoss
 /**
  * returns items
  *
  * @return mixed items as array
  * @param mixed $options search, offset and filter params
  */
 public function get($options = array())
 {
     $options = array_merge(array('starred' => false, 'offset' => 0, 'search' => false, 'items' => \F3::get('items_perpage')), $options);
     $items = $this->backend->get($options);
     // remove private posts with private tags
     if (!\F3::get('auth')->showPrivateTags()) {
         foreach ($items as $idx => $item) {
             $tags = explode(',', $item['tags']);
             foreach ($tags as $tag) {
                 if (strpos(trim($tag), '@') === 0) {
                     unset($items[$idx]);
                     break;
                 }
             }
         }
         $items = array_values($items);
     }
     // remove posts with hidden tags
     if (!isset($options['tag']) || strlen($options['tag']) === 0) {
         foreach ($items as $idx => $item) {
             $tags = explode(',', $item['tags']);
             foreach ($tags as $tag) {
                 if (strpos(trim($tag), '#') === 0) {
                     unset($items[$idx]);
                     break;
                 }
             }
         }
         $items = array_values($items);
     }
     return $items;
 }
예제 #2
0
파일: user_login.php 프로젝트: pshreez/PHP
 function logout()
 {
     if (F3::get('SESSION.onlineUser')) {
         F3::clear('SESSION.onlineUser');
         F3::reroute('/');
     }
 }
예제 #3
0
 function home()
 {
     $this->view->title = 'Open Postbox | India';
     $this->view->caption = 'Latest postboxes added.';
     $q = 'select * from post_box order by cast(created_time as int) desc limit 14';
     $POSTBOX_DB = \F3::get('POSTBOX_DB');
     $result = $POSTBOX_DB->exec($q);
     $array_all_postboxes = array();
     foreach ($result as $row) {
         $single_postbox = array();
         $single_postbox['post_id'] = $row["post_id"];
         $single_postbox['lat'] = $row["lat"];
         $single_postbox['lan'] = $row["lan"];
         $single_postbox['pincode'] = $row["pincode"];
         $single_postbox['caption'] = $row["caption"];
         $single_postbox['img'] = $row["img"];
         $single_postbox['picture_url'] = $row["picture_url"];
         $array_all_postboxes[$row["post_id"]] = $single_postbox;
     }
     $this->view->set('array_all_postboxes', $array_all_postboxes);
     $q = 'select * from stats order by sl desc limit 1';
     $result = $POSTBOX_DB->exec($q);
     foreach ($result as $row) {
         $post_count = $row["post_count"];
         $user_count = $row["user_count"];
         $this->view->set('is_home', 1);
         $this->view->set('post_count', $post_count);
         $this->view->set('user_count', $user_count);
     }
     $out = Template::instance()->render('basic/sub_home.html');
     $this->view->set('sub_out_put', $out);
     $this->view->set('enable_maps', 1);
     echo Template::instance()->render('basic/main.html');
 }
예제 #4
0
 /**
  * add new source
  *
  * @return int new id
  * @param string $title
  * @param string $tags
  * @param string $spout the source type
  * @param mixed $params depends from spout
  */
 public function add($title, $tags, $spout, $params)
 {
     // sanitize tag list
     $tags = implode(',', preg_split('/\\s*,\\s*/', trim($tags), -1, PREG_SPLIT_NO_EMPTY));
     $res = \F3::get('db')->exec('INSERT INTO sources (title, tags, spout, params) VALUES (:title, :tags, :spout, :params) RETURNING id', array(':title' => trim($title), ':tags' => $tags, ':spout' => $spout, ':params' => htmlentities(json_encode($params))));
     return $res[0]['id'];
 }
예제 #5
0
파일: kaydet.php 프로젝트: seyyah/uzkay
function yukle($hedef = NULL, $alan = 'file')
{
    $yuklenen = F3::get("FILES.{$alan}.tmp_name");
    // hedef ve yüklenen dosyanın boş olmasına izin veriyoruz
    // herhangi biri boşsa mesele yok, çağırana dön
    if (empty($hedef) || empty($yuklenen)) {
        return true;
    }
    // bu bir uploaded dosya olmalı, fake dosyalara izin yok
    if (is_uploaded_file($yuklenen)) {
        // boyutu sınırla, değeri öylesine seçtim
        if (filesize($yuklenen) > 600000) {
            F3::set('error', 'Resim çok büyük');
        } else {
            if (exif_imagetype($yuklenen) != IMAGETYPE_JPEG) {
                F3::set('error', 'Resim JPEG değil');
            } else {
                if (file_exists($hedef)) {
                    F3::set('error', 'Resim zaten kaydedilmiş');
                } else {
                    if (!move_uploaded_file($yuklenen, $hedef)) {
                        F3::set('error', 'Dosya yükleme hatası');
                    }
                }
            }
        }
        // yok başka bir ihtimal!
    } else {
        // bu aslında bir atak işareti
        F3::set('error', 'Dosya geçerli bir yükleme değil');
    }
    return false;
}
예제 #6
0
파일: db.php 프로젝트: seyyah/uzkay
function is_table_exists($table, $db = NULL)
{
    if (is_null($db)) {
        $db = F3::get('DB.name');
    }
    return $db && F3::sql(array("SELECT COUNT(*) AS found " . "FROM information_schema.tables " . "WHERE table_schema='{$db}' " . "AND table_name='{$table}';"));
}
예제 #7
0
파일: Venue.php 프로젝트: jelek92/echo
function set_venue_data_from_POST()
{
    F3::set('name', F3::scrub($_POST['name']));
    F3::set('address', F3::scrub($_POST['address']));
    F3::set('postcode', F3::scrub($_POST['postcode']));
    F3::set('info', F3::scrub($_POST['info']));
}
예제 #8
0
파일: f3.php 프로젝트: bcosca/fatfree-core
 /**
  *	Forward function calls to framework
  *	@return mixed
  *	@param $func callback
  *	@param $args array
  **/
 static function __callstatic($func, array $args)
 {
     if (!self::$fw) {
         self::$fw = Base::instance();
     }
     return call_user_func_array([self::$fw, $func], $args);
 }
예제 #9
0
 public function get()
 {
     if ($this->flag['search']) {
         if (isset($_GET['q']) && $_GET['q'] != '') {
             // Fetch Search Query
             $query = F3::scrub($_GET['q']);
             $search = new SearchModel();
             // Fetch Search Results
             if ($this->results = $search->items($query)) {
                 // Reroute if one match
                 if (count($this->results) == 1 && $this->redirect) {
                     F3::reroute('/loot/' . $this->results[0]['urlname']);
                 }
                 $this->title = "Search: \"" . $query . "\" - Diablo 2 Database";
                 $this->heading = "Search: \"" . $query . "\"";
                 F3::set('NOTIFY.success', "Rejoice! " . count($this->results) . " matches found!");
                 $this->render('search.php');
             } else {
                 $this->heading = "Search: \"" . $query . "\"";
                 F3::set('NOTIFY.warning', "Nothing found in the database. Try the <a href=/loot/>Loot Directory</a>.");
                 $this->render('blank.php');
             }
         } else {
             F3::reroute('/');
         }
     } else {
         F3::set('NOTIFY.warning', "Search is temporarily disabled. Please try again later.");
         $this->render('blank.php');
     }
 }
예제 #10
0
 public function item($identifier, $options = array())
 {
     try {
         // Configurations
         $this->options = array_merge($this->options, $options);
         // Initialize Item Object
         $item = new ItemModel();
         // Fetch Shared Item Data
         DB::sql($this->query['item'], array("item" => $identifier));
         $shared = F3::get('DB')->result[0];
         // Presumably, no item data found
         if (empty($shared)) {
             throw new Exception("No item found.");
         }
         // Assign Class Attributes
         foreach ($shared as $key => $attribute) {
             $item->{$key} = $attribute;
         }
         // Fetch Parent
         // Fetch Flags
         // Property Collection
         if ($this->options['properties']) {
             switch ($item->rarity) {
                 case "normal":
                     $item->properties['normal'] = DB::sql($this->query['properties'], array("item" => $item->name));
                     break;
                 case "unique":
                     $item->properties['magic'] = DB::sql($this->query['properties_magic'], array("item" => $item->name));
                     break;
                 case "set":
                     $item->properties['magic'] = DB::sql($this->query['properties_magic'], array("item" => $item->name));
                     $item->properties['set'] = DB::sql($this->query['properties_set'], array("item" => $item->name));
                     break;
                 default:
                     throw new Exception("Unknown rarity.");
             }
             // Translate Item Properties
             $tokens = array("@param", "@min", "@max");
             foreach ($item->properties as $type_key => $type) {
                 if ($type_key != 'normal') {
                     foreach ($type as $row_key => $row) {
                         // Determine which string to use
                         $field = $row['minimum'] == $row['maximum'] ? "translation" : "translation_varies";
                         // Order must line up with $tokens
                         $values = array($row['parameter'], $row['minimum'], $row['maximum']);
                         // Replace database tokens with values
                         $item->properties[$type_key][$row_key]['translation'] = str_replace($tokens, $values, $row[$field]);
                         // Unset unecessary string
                         unset($item->properties[$type_key][$row_key]['translation_varies']);
                     }
                 }
             }
         }
     } catch (Excecption $e) {
         error_log($e->getMessage());
         return false;
     }
     // Return JSON string
     return json_encode($item);
 }
예제 #11
0
 function pull_data()
 {
     $this->view->set('title', 'PostBox - Instagram Data Pull');
     $instagram_api_clinet_id = 'b9d4b604105648168c671293d10cc67e';
     $instagram_api_url = 'https://api.instagram.com/v1/tags/openpostboxindia/media/recent?client_id=' . $instagram_api_clinet_id;
     $data_pull_messages = array();
     $ch = curl_init($instagram_api_url);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
     $json = curl_exec($ch);
     curl_close($ch);
     $data = json_decode($json, true);
     //var_dump($data);
     if ($data['meta']['code'] == 200) {
         //echo 'sucess';
         $picture_dicts = $data['data'];
         foreach ($picture_dicts as $pic) {
             $tags = implode(', ', $pic['tags']);
             $pincode = 0;
             foreach ($pic['tags'] as $tag) {
                 if ($this->startswith4($tag, 'pin')) {
                     $pincode = substr($tag, 3, 10);
                 }
             }
             $lat = $pic['location']['latitude'];
             $lan = $pic['location']['longitude'];
             $created_time = $pic['created_time'];
             $picture_url = $pic['images']['standard_resolution']['url'];
             $post_id = $pic['id'];
             $username = '******' . $pic["user"]["username"];
             $website = '';
             //$pic["user"]["website"];
             $caption = $pic["caption"]["text"];
             //check if post_id exists, if yes then go to next one. else insert
             $data_pull_messages[] = "Processing the post_id=" . $post_id;
             $q = 'select count(*) as count_posts from post_box where post_id="' . $post_id . '"';
             $POSTBOX_DB = \F3::get('POSTBOX_DB');
             $result = $POSTBOX_DB->exec($q);
             //print '\n'.$q;
             $count_posts = 0;
             foreach ($result as $row) {
                 $count_posts = $row['count_posts'];
             }
             if ($count_posts == 0) {
                 $data_pull_messages[] = "Lets INSERT.";
                 $i = 'insert into post_box( post_id , picture_url , tags , lat , lan , created_time , username , website,pincode, caption, provider) values(' . '"' . $post_id . '","' . $picture_url . '","' . $tags . '","' . $lat . '","' . $lan . '","' . $created_time . '","' . $username . '","' . $website . '","' . $pincode . '","' . $caption . '"' . ',"Instagram")';
                 //print $i;
                 $POSTBOX_DB->exec($i);
             } else {
                 $data_pull_messages[] = "Already exists.";
             }
         }
     }
     $this->view->set('data_pull_messages', $data_pull_messages);
     $out = Template::instance()->render('basic/sub_data_pull.html');
     $this->view->set('sub_out_put', $out);
     echo Template::instance()->render('basic/main.html');
 }
예제 #12
0
 public function jwt_decode($token)
 {
     try {
         return JWT::decode($token, F3::get('custom.SUPER-KEY'));
     } catch (Exception $e) {
         return false;
     }
 }
예제 #13
0
 /**
  * loads content for given source
  *
  * @return void
  * @param string $url
  */
 public function load($params)
 {
     $this->apiKey = $params['api'];
     if (strlen(trim($this->apiKey)) == 0) {
         $this->apiKey = \F3::get('readability');
     }
     parent::load(array('url' => $params['url']));
 }
예제 #14
0
파일: Tags.php 프로젝트: andrel/selfoss
 /**
  * pass any method call to the backend.
  * 
  * @return methods return value
  * @param string $name name of the function
  * @param array $args arguments
  */
 public function __call($name, $args)
 {
     if (method_exists($this->backend, $name)) {
         return call_user_func_array(array($this->backend, $name), $args);
     } else {
         \F3::get('logger')->log('Unimplemented method for ' . \F3::get('db_type') . ': ' . $name, \ERROR);
     }
 }
예제 #15
0
 private function get_how_to_use_content($f3)
 {
     $content = "How to use content.";
     $file = F3::instance()->read('help/README.md');
     $html = Markdown::instance()->convert($file);
     $f3->set('how_to_use_content', $html);
     return $content;
 }
예제 #16
0
 public function check_configuration()
 {
     $config = new DB\Jig\Mapper($this->db, 'sysconfig.json');
     if (!$config->load()) {
         echo json_encode(array('message' => 'No config file found'));
         F3::error(428);
         exit;
     }
 }
예제 #17
0
 /**
  * cleanup orphaned and old items
  *
  * @return void
  * @param DateTime $date date to delete all items older than this value [optional]
  */
 public function cleanup(\DateTime $date = NULL)
 {
     \F3::get('db')->exec('DELETE FROM items WHERE id IN (
                             SELECT items.id FROM items LEFT JOIN sources
                             ON items.source=sources.id WHERE sources.id IS NULL)');
     if ($date !== NULL) {
         \F3::get('db')->exec('DELETE FROM items WHERE starred=0 AND datetime<:date', array(':date' => $date->format('Y-m-d') . ' 00:00:00'));
     }
 }
예제 #18
0
 /**
  * get the user agent to use for web based spouts
  *
  * @return the user agent string for this spout
  */
 public static function getUserAgent($agentInfo = null)
 {
     $userAgent = 'Selfoss/' . \F3::get('version');
     if (is_null($agentInfo)) {
         $agentInfo = array();
     }
     $agentInfo[] = '+http://selfoss.aditu.de';
     return $userAgent . ' (' . implode('; ', $agentInfo) . ')';
 }
예제 #19
0
 static function resolve_picturl($id, $size = "md", $type = "png")
 {
     try {
         $pic = new \Model\Imager();
         $pic->db = $pic->db->find(array("pid=?", $id))[0];
     } catch (\Exception $e) {
         return;
     }
     return \F3::alias('virtualasset', array("link" => $pic->db->link, "size" => $size, "id" => $pic->db->srcx, "type" => $type));
 }
예제 #20
0
파일: 5template.php 프로젝트: seyyah/f3
function main()
{
    F3::set('name', 'world');
    F3::set('buddy', array('Tom', 'Dick', 'Harry'));
    F3::set('gender', 'M');
    F3::set('loggedin', 'true');
    F3::set('div', array('coffee' => array('arabica', 'barako', 'liberica', 'kopiluwak'), 'tea' => array('darjeeling', 'pekoe', 'samovar')));
    F3::set('rows', array(1, 2, 3, 4, 5));
    echo F3::serve('5template.htm');
}
예제 #21
0
 public function normalize_properties_normal($table, $identifier)
 {
     $all = F3::sql("SELECT * FROM {$table}");
     foreach ($all as $row) {
         $name = $row[$identifier];
         foreach ($row as $key => $column) {
             echo "{$name},{$key},{$column}<br>";
         }
     }
 }
예제 #22
0
 function reverse_geocode_batch()
 {
     $this->view->set('title', 'PostBox - Google Reverse Geo Code');
     $data_pull_messages = array();
     $POSTBOX_DB = \F3::get('POSTBOX_DB');
     $q = 'select post_id,lat,lan from post_box where state is null';
     $data_pull_messages[] = "START of Reverse geo code process";
     $result = $POSTBOX_DB->exec($q);
     foreach ($result as $row) {
         $post_id = $row["post_id"];
         $lat = $row["lat"];
         $lan = $row["lan"];
         $data_pull_messages[] = "For id." . $post_id;
         $url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=" . $lat . "," . $lan . "&sensor=false&region=in";
         $ch = curl_init($url);
         curl_setopt($ch, CURLOPT_HEADER, 0);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
         $json = curl_exec($ch);
         curl_close($ch);
         $data = json_decode($json, true);
         $road = '';
         $locality = '';
         $district = '';
         $state = '';
         $formatted_address = '';
         foreach ($data["results"] as $key => $val) {
             foreach ($val["address_components"] as $key1 => $val1) {
                 if (in_array("route", $val1['types'])) {
                     $road = $val1['long_name'];
                 }
                 if (in_array("locality", $val1['types'])) {
                     $locality = $val1['long_name'];
                 }
                 if (in_array("administrative_area_level_2", $val1['types'])) {
                     $district = $val1['long_name'];
                 }
                 if (in_array("administrative_area_level_1", $val1['types'])) {
                     $state = $val1['long_name'];
                 }
                 $data_pull_messages[] = "adding " . $val1['long_name'] . " type" . implode($val1['types']);
             }
             $formatted_address = $val["formatted_address"];
             break;
         }
         $q = 'update post_box set road=:road,locality=:locality,district=:district, state=:state, formatted_address=:formatted_address where post_id=:post_id';
         $data_pull_messages[] = "add the reverse geocode details for the post_id=" . $post_id;
         $POSTBOX_DB->exec($q, array(':post_id' => $post_id, ':road' => $road, ':locality' => $locality, ':district' => $district, ':state' => $state, ':formatted_address' => $formatted_address));
     }
     $data_pull_messages[] = "END of Reverse geo code process";
     $this->view->set('data_pull_messages', $data_pull_messages);
     $out = Template::instance()->render('basic/sub_data_pull.html');
     $this->view->set('sub_out_put', $out);
     echo Template::instance()->render('basic/main.html');
 }
예제 #23
0
 /**
  * load image
  *
  * @return bool
  * @param string $url source url
  * @param int $width
  * @param int $height
  */
 public function loadImage($url, $width = false, $height = false)
 {
     // load image
     $data = @file_get_contents($url);
     if ($data === false) {
         return false;
     }
     // get image type
     $tmp = \F3::get('cache') . '/' . md5($url);
     file_put_contents($tmp, $data);
     $imgInfo = @getimagesize($tmp);
     if (strtolower($imgInfo['mime']) == 'image/vnd.microsoft.icon') {
         $type = 'ico';
     } elseif (strtolower($imgInfo['mime']) == 'image/png') {
         $type = 'png';
     } elseif (strtolower($imgInfo['mime']) == 'image/jpeg') {
         $type = 'jpg';
     } elseif (strtolower($imgInfo['mime']) == 'image/gif') {
         $type = 'gif';
     } elseif (strtolower($imgInfo['mime']) == 'image/x-ms-bmp') {
         $type = 'bmp';
     } else {
         @unlink($tmp);
         return false;
     }
     // convert ico to png
     if ($type == 'ico') {
         $ico = new \floIcon();
         @$ico->readICO($tmp);
         if (count($ico->images) == 0) {
             @unlink($tmp);
             return false;
         }
         ob_start();
         @imagepng($ico->images[count($ico->images) - 1]->getImageResource());
         $data = ob_get_contents();
         ob_end_clean();
     }
     // parse image for saving it later
     @unlink($tmp);
     try {
         $wideImage = \WideImage::load($data);
     } catch (\Exception $e) {
         return false;
     }
     // resize
     if ($width !== false && $height !== false) {
         if ($wideImage->getHeight() > $height || $wideImage->getWidth() > $width) {
             $wideImage = $wideImage->resize($width, $height);
         }
     }
     // return image as png
     $data = $wideImage->asString('png', 0);
     return $data;
 }
예제 #24
0
 public function relations()
 {
     // Select magic + class + division
     $division = "\n                SELECT class, division\n                FROM relate_loot_normal\n            ";
     foreach (F3::sql($division) as $row) {
         F3::set('class', F3::get('DB.pdo')->quote($row['class']));
         F3::set('division', F3::get('DB.pdo')->quote($row['division']));
         $query = "\n                    UPDATE loot\n                    SET division = {@division}\n                    WHERE class = {@class}\n                ";
         F3::sql($query);
     }
 }
예제 #25
0
파일: AdminLog.php 프로젝트: pshreez/PHP
 public static function add($vehicle, $form_type, $status)
 {
     $log = new Axon('admin_log');
     $log->date = date("Y-m-d H:i:s");
     $log->admin_username = F3::get('SESSION.username');
     //admin id
     $log->vehicle_no = $vehicle;
     $log->status = $status;
     $log->form_type = $form_type;
     $log->save();
 }
예제 #26
0
파일: Items.php 프로젝트: dled/selfoss
 /**
  * unstarr item
  * json
  *
  * @return void
  */
 public function unstarr()
 {
     $this->needsLoggedIn();
     $id = \F3::get('PARAMS["item"]');
     $itemDao = new \daos\Items();
     if (!$itemDao->isValid('id', $id)) {
         $this->view->error('invalid id');
     }
     $itemDao->unstarr($id);
     $this->view->jsonSuccess(array('success' => true));
 }
예제 #27
0
파일: admin.php 프로젝트: pshreez/PHP
 function logout()
 {
     if (!F3::get('SESSION.asid')) {
         F3:
         reroute('/admin');
     }
     if (F3::get('SESSION.asid')) {
         $this->clear('SESSION.asid');
         $this->clear('SESSION.admin');
         F3::reroute('/admin');
     }
 }
예제 #28
0
 /**
 		Generate CAPTCHA image
 			@param $dimx integer
 			@param $dimy integer
 			@param $len integer
 			@param $ttfs string
 			@param $var string
 			@param $die boolean
 			@public
 	**/
 static function captcha($dimx = 150, $dimy = 50, $len = 5, $ttfs = 'cube', $var = 'captcha', $die = TRUE)
 {
     $base = self::rgb(self::$vars['BGCOLOR']);
     $trans = self::$vars['FGTRANS'];
     // Specify Captcha seed
     $seed = substr(md5(uniqid()), 0, $len);
     F3::set('SESSION.' . $var, $seed);
     // Font size
     $size = 0.9 * min($dimx / $len, $dimy);
     // Load TrueType fonts
     $fonts = self::split($ttfs);
     $file = self::$vars['FONTS'] . self::fixslashes($fonts[array_rand($fonts)]) . '.ttf';
     $stats =& self::ref('STATS');
     if (!isset($stats['FILES'])) {
         $stats['FILES'] = array('fonts' => array());
     }
     $stats['FILES']['fonts'][basename($file)] = filesize($file);
     $maxdeg = 12;
     // Create blank image
     $captcha = imagecreatetruecolor($dimx, $dimy);
     list($r, $g, $b) = $base;
     $bg = imagecolorallocate($captcha, $r, $g, $b);
     imagefill($captcha, 0, 0, $bg);
     $width = 0;
     // Insert each Captcha character
     for ($i = 0; $i < $len; $i++) {
         // Random angle
         $angle = $maxdeg - mt_rand(0, $maxdeg * 2);
         // Get CAPTCHA character from session cookie
         $char = $seed[$i];
         $fg = imagecolorallocatealpha($captcha, mt_rand(0, 255 - $trans), mt_rand(0, 255 - $trans), mt_rand(0, 255 - $trans), $trans);
         // Compute bounding box metrics
         $bbox = imagettfbbox($size, 0, $file, $char);
         $w = max($bbox[2], $bbox[4]) - max($bbox[0], $bbox[6]);
         $h = max($bbox[1], $bbox[3]) - max($bbox[5], $bbox[7]);
         $sin = sin(deg2rad($angle));
         imagettftext($captcha, $size, $angle, 0.9 * $width + abs($h * $sin), $dimy - $h / 2 + abs($w * $sin), $fg, $file, $char);
         $width += $w + abs($h * $sin);
         imagecolordeallocate($captcha, $fg);
     }
     // Make the background transparent
     imagecolortransparent($captcha, $bg);
     // Send output as PNG image
     if (PHP_SAPI != 'cli' && !headers_sent()) {
         header(self::HTTP_Content . ': image/png');
         header(self::HTTP_Powered . ': ' . self::TEXT_AppName . ' ' . '(' . self::TEXT_AppURL . ')');
     }
     imagepng($captcha, NULL, self::PNG_Compress, PNG_NO_FILTER);
     if ($die) {
         die;
     }
 }
예제 #29
0
 /**
  * login user
  *
  * @return bool
  * @param string $username
  * @param string $password
  */
 public function login($username, $password)
 {
     if ($this->enabled()) {
         if ($username == \F3::get('username') && hash("sha512", \F3::get('salt') . $password) == \F3::get('password')) {
             $this->loggedin = true;
             $_SESSION['loggedin'] = true;
             return true;
         } else {
             return false;
         }
     }
     return true;
 }
예제 #30
0
파일: Sources.php 프로젝트: dled/selfoss
 public function get()
 {
     $sources = $this->backend->get();
     // remove items with private tags
     if (!\F3::get('auth')->showPrivateTags()) {
         foreach ($sources as $idx => $source) {
             if (strpos($source['tags'], "@") !== false) {
                 unset($sources[$idx]);
             }
         }
         $sources = array_values($sources);
     }
     return $sources;
 }