| #2 | Phalcon\Db\Adapter\Pdo->__construct(Array([host] => 188.132.151.223, [username] => st_xsdbt, [password] => H5VifunEqAvigisawALej2mEgu4uN1, [dbname] => st_xsdbt, [charset] => utf8))
/home/teknoloji/domains/siberteknoloji.com/public_html/config/services.php (105) <?php
use \Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
use Phalcon\Mvc\Router\Annotations as Router;
use Phalcon\Mvc\View as View;
use Phalcon\Mvc\View\Engine\Volt as VoltEngine;
use Phalcon\Flash\Direct as DirectMessage;
use Phalcon\Flash\Session as FlashMessage;
use Phalcon\Mvc\Url as UrlResolver;
use Phalcon\DI\FactoryDefault as FactoryDefault;
use Phalcon\Session\Adapter\Files as SessionAdapter;
use Phalcon\Session\Bag as Bag;
use \Phalcon\Mvc\Model\Manager as ModelsManager;
use Repositories\Auth\Auth;
/**
* Bağımlılıkları ekleyebilmek için FactoryDefault sınıfını örnekliyoruz.
*/
$di = new FactoryDefault();
/**
* Session işlemlerini burada yapıyoruz. Önce session tanımlaması, sonra da küme tanımlaması yapıyoruz.
*/
$di['session'] = function(){
$session = new SessionAdapter();
$session->start();
return $session;
};
/* Kullanıcı kümesi */
$di['user_info'] = function(){
return new Bag('user_info');
};
/* İçerik kümesi */
$di['post_info'] = function(){
return new Bag('post_info');
};
/**
* Arayüz işlemlerini volt engine üzerinden yapacağımızı belirtiyoruz.
*/
$di['view'] = function(){
$view = new View();
$view->registerEngines(array(
'.volt' => function($view, $di){
$volt = new VoltEngine($view, $di);
$volt->setOptions(array(
'compiledPath' => __DIR__.'/../cache/volt/',
'compiledSeparator' => '_'
));
$compiler = $volt->getCompiler();
$compiler->addFunction('dateformat', '\Yazar\Shared\Extras\Helpers::dateformat');
$compiler->addFunction('tags', '\Yazar\Shared\Extras\Helpers::tags');
$compiler->addFunction('isset', 'isset');
$compiler->addFunction('check_file', 'file_exists');
$compiler->addFunction('in_array', 'in_array');
$compiler->addFunction('is_null', 'is_null');
$compiler->addFunction('time', 'time');
$compiler->addFunction('date', 'date');
$compiler->addFunction('number_format', 'number_format');
$compiler->addFunction('excerpt', 'mb_substr');
$compiler->addFunction('new_line', '\Yazar\Shared\Extras\Helpers::nl2p');
$compiler->addFunction('filesize', '\Yazar\Shared\Extras\Helpers::filesize');
$compiler->addFunction('length', 'mb_strlen');
$compiler->addFunction('print_r', 'print_r');
$compiler->addFunction('debug', 'var_dump');
$compiler->addFunction('glob', 'glob');
return $volt;
}
));
return $view;
};
$di['router'] = function(){
$router = new Router(false);
require __DIR__.'/routes.php';
return $router;
};
$di['flash'] = function(){
return new FlashMessage(array(
'error' => 'alert alert-danger',
'success' => 'alert alert-success',
'notice' => 'alert alert-info',
'warning' => 'alert alert-warning',
));
};
$di['flashSession'] = function(){
return new FlashMessage(array(
'error' => 'alert alert-danger',
'success' => 'alert alert-success',
'notice' => 'alert alert-info',
'warning' => 'alert alert-warning',
));
};
$di['db'] = function () use ($config){
$connection = new DbAdapter(array(
'host' => $config->database->host,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->dbname,
'charset' => $config->database->charset
));
return $connection;
};
$di['config'] = function() use ($config){
return $config;
};
/**
* URL tanımlamalarını doğru yapabilmesi için phalcon'a dizin bildirimi yapıyoruz.
*/
$di['url'] = function() use ($config){
$url = new UrlResolver();
$url->setBaseUri($config->url->base);
return $url;
};
$di["modelsManager"] = function(){
return new ModelsManager();
};
$di['auth'] = function(){
return new Auth();
};
$di['crypt'] = function() use($di) {
$crypt = new \Phalcon\Crypt();
$crypt->setMode(MCRYPT_MODE_CFB);
$crypt->setKey('4ga*/s7d-as*dasd4a6s954fga-sd12%%%&');
return $crypt;
};
$di['cookies'] = function () {
$cookies = new \Phalcon\Http\Response\Cookies();
$cookies->useEncryption(false);
return $cookies;
}; |
| #15 | Phalcon\Mvc\Model::__callStatic(findFirstByDate, Array([0] => 2025-10-01))
/home/teknoloji/domains/siberteknoloji.com/public_html/shared/controllers/ControllerBase.php (80) <?php
namespace Yazar\Shared\Controllers;
use Phalcon\Db\RawValue;
use Yazar\Shared\Models\Championships;
use Yazar\Shared\Models\Comments;
use Yazar\Shared\Models\LogsPosts;
use Yazar\Shared\Models\Menu;
use Yazar\Shared\Models\Users as Users,
Yazar\Shared\Models\Posts as Posts,
Yazar\Shared\Models\Champion as Champion,
Yazar\Shared\Models\Categories as Categories,
Yazar\Shared\Models\PrivateMessages as PM;
use Phalcon\Session\Bag as Oturum;
use Repositories\Links\Links;
class ControllerBase extends \Phalcon\Mvc\Controller {
public $customJs, $customCss, $profileInfo, $notifications, $page_meta;
public $sidebar_links, $footer_links;
public function beforeExecuteRoute()
{
if($this->auth->hasRememberMe() && is_null($this->user_info->id))
{
$this->auth->loginWithRememberMe();
}
}
public function category_list($parent)
{
$find = Categories::find(array('conditions'=>"ID={$parent} OR parent={$parent}"));
$return = array();
if($find){
foreach($find->toArray() as $arr)
{
$return[] = $arr['ID'];
}
$return = implode(',', $return);
}else{
$return = 0;
}
return $return;
}
public function initialize() {
$this->page_meta = array(
'description'=>'Yazılım, Robotik, Oyun, Araba ve Teknoloji Haberleri üzerine kişisel blog',
'keywords'=>'teknoloji, teknoloji haberleri, siber teknoloji, teknoloji sitesi'
);
$this->response->setHeader("X-Powered-By", "fatihemre");
if(!is_array($this->post_info->post_view)){
$this->post_info->post_view = array();
}
$users = new Users();
$this->profileInfo = $users->user_info($this->user_info->nick);
$this->customJs = $this->assets->collection('custom-js');
$this->customCss = $this->assets->collection('custom-css');
if($this->profileInfo){
$this->notifications = (object)$this->notifications($this->profileInfo->ID);
if($this->profileInfo->role != $this->user_info->role)
{
$this->response->redirect(['for'=>'blog-logout']);
}
}
$date = strtotime("last Month");
$champion = Champion::findFirstByDate(date("Y-m-01", $date));
if($champion)
$this->view->setVar('champion', $champion);
$subjects = Championships::findByPeriod(date("Y-m-01"));
if($subjects->count() > 0)
{
$this->view->setVar('subjects', $subjects);
}
$ipucu = Posts::find(array('conditions'=>"category_id IN({$this->category_list(7)}) AND status='publish' AND deleted='N'", 'order'=>'created_at DESC', 'limit'=>10));
$links = new Links();
$links->setup('config', true);
$links->setup('end', date("Y-m-d", time()));
$links->setup('max', 10);
$this->sidebar_links = $links->get_sidebar_links();
$this->footer_links = $links->get_links('footer');
//$this->debug($this->menuList('ana-menu')->toArray());
$this->view->setVar('ana_menu', $this->menuList('ana-menu'));
$this->view->setVar('last_comments', $this->last_comments());
$this->view->setVar('sidebar_links', $this->sidebar_links);
$this->view->setVar('footer_links', $this->footer_links);
$this->view->setVar('notifications', $this->notifications);
$this->view->setVar('user_info', (isset($this->user_info->id) && $this->user_info->id > 0) ? $this->user_info : false);
$this->view->setVar('profileInfo', $this->profileInfo);
$this->view->setVar('check_new_message', $this->checkNewMessage());
$this->view->setVar('check_friend_request', $this->checkFriendRequest());
$this->view->setVar('ipucu', $ipucu);
$this->view->setVar('category_menu', $this->category_menu());
$this->view->setVar('version', $this->getVersion());
$this->view->setVar('donate', $this->getDonate());
$this->view->setVar('active_page', $this->router->getActionName());
$this->view->setVar('page_title', "SiberTeknoloji | Teknoloji ve Haber Bloğu");
$this->view->setVar('page_meta', $this->page_meta);
$this->view->setVar('app_config', $this->config->app);
}
protected function used_subjects()
{
$users_posts = Posts::find(["conditions"=>"cs_id > 0 and deleted='N' and status='publish' and user_id=:user_id:", "bind"=>["user_id"=> $this->user_info->id], "columns"=>"cs_id"]);
$hangi_konular = [];
if($users_posts)
{
foreach($users_posts->toArray() as $p)
{
$hangi_konular[] = $p['cs_id'];
}
}
return $hangi_konular;
}
private function menuList($whereis=null)
{
return $this->list_menu($whereis)->getMenu(array('conditions'=>'parent_id=0', 'order'=>'sort ASC'));
}
private function list_menu($key=null)
{
return Menu::findFirstByKey($key);
}
private function last_comments()
{
return Comments::find(array('conditions'=>'status=:status:', 'bind'=>array('status'=>'publish'), 'order'=>'created_at DESC', 'limit'=>10));
}
public function post_view($post,$user=false){
$return = null;
if($user)
{
$log = LogsPosts::findFirst(array('conditions'=>"post_id={$post} and user_id={$user}"));
if($log){
$return = $log->view + 1;
$log->view = $return;
$log->updated_at = new RawValue('now()');
$log->save();
}else{
$return = 0;
$log = new LogsPosts();
$log->post_id = $post;
$log->user_id = $user;
$log->view = 1;
$log->score = 0;
$log->created_ip = $this->request->getClientAddress();
$log->created_at = new RawValue('now()');
$log->updated_at = null;
$log->save();
$update = Posts::findFirst($post);
$update->view = $update->view + 1;
$update->save();
}
}
else
{
if(!in_array($post, $this->post_info->post_view)){
$update = Posts::findFirst($post);
$update->view = $update->view + 1;
$update->save();
$key = $this->post_info->post_view;
$key[] = $post;
$this->post_info->post_view = $key;
}
}
return $return;
}
private function category_menu(){
$category = Categories::find(array('conditions'=>"parent=0 AND ID<>35"));
return $category->count() > 0 ? $category : false;
}
private function notifications($userID){
$notifications = array(
'draft' => Posts::count(array('conditions'=>"status='draft' and user_id={$userID} and deleted='".Posts::NOT_DELETED."'")),
'wait' => Posts::count(array('conditions'=>"status='wait' and user_id={$userID} and deleted='".Posts::NOT_DELETED."'")),
'reject' => Posts::count(array('conditions'=>"status='reject' and user_id={$userID} and deleted='".Posts::NOT_DELETED."'")),
'new_message'=>$this->checkNewMessage(),
'new_friend'=>$this->checkFriendRequest()
);
$notifications['count'] = array_sum($notifications);
return $notifications;
}
private function checkNewMessage(){
if(isset($this->user_info->id) && $this->user_info->id > 0){
$pm = new PM();
return $pm->check_new_message($this->user_info->id);
}
}
private function checkFriendRequest(){
if(isset($this->user_info->id) && $this->user_info->id > 0){
$user = new Users();
return $user->user_friend_request($this->user_info->id);
}
}
public function getDonate()
{
$file = file_get_contents('../public/donate.json');
$result = json_decode($file);
$percent = ( $result->result * 100 ) / $result->total;
$result->percent = round($percent, 2);
return $result;
}
public function getVersion(){
$file = file_get_contents("../public/version.json");
$system = json_decode($file);
return $system->version;
}
public function debug($message) {
echo '<pre>';
is_bool($message) ? var_dump($message) : print_r($message);
echo '</pre>';
exit;
}
} |
| #16 | Yazar\Shared\Controllers\ControllerBase->initialize()
/home/teknoloji/domains/siberteknoloji.com/public_html/apps/blog/controllers/PostController.php (23) <?php
namespace Yazar\Blog\Controllers;
use Yazar\Shared\Extras\Akismet;
use Yazar\Shared\Models\Categories,
Yazar\Shared\Models\Posts,
Yazar\Shared\Models\Tags,
Yazar\Shared\Controllers\ControllerBase,
Yazar\Shared\Models\Users as Users,
Yazar\Shared\Models\PrivateMessages as PM,
\Phalcon\Image\Adapter\GD as GD,
Yazar\Shared\Extras\Helpers;
use Yazar\Shared\Models\Comments;
use Yazar\Shared\Models\Pages;
use Yazar\Shared\Models\PostsMeta;
use \Phalcon\Paginator\Adapter\Model as Pagination;
class PostController extends ControllerBase {
public function initialize() {
parent::initialize();
}
private function SocialMetaTags($post)
{
$return = array();
if($post){
$description=mb_substr(strip_tags($post->content),0,160,"UTF-8");
$thumbnail= 'https://siberteknoloji.com/'.$post->thumbnail;
$return[] = '<meta property="og:title" content="'.$post->title.'" />'."\n";
$return[] = '<meta property="og:site_name" content="SiberTeknoloji | Teknoloji ve Haber Bloğu"/>'."\n";
$return[] = '<meta property="og:url" content="'.$this->url->get(array('for'=>'blog-post', 'postID'=>$post->ID, 'slug'=>$post->slug)).'" />'."\n";
$return[] = '<meta property="og:description" content="'.$description.'" />'."\n";
$return[] = '<meta property="og:image" content="'.$thumbnail.'" />'."\n";
$return[] = '<meta property="fb:app_id" content="252444522421505" />'."\n";
$return[] = '<meta property="og:type" content="article" />'."\n";
$return[] = '<meta property="article:publisher" content="https://www.facebook.com/siberteknolojicom" />'."\n";
$return[] = '<meta name="twitter:card" content="summary_large_image">'."\n";
$return[] = '<meta name="twitter:site" content="@SiberTeknoloji">'."\n";
if($post->getUser() && !is_null($post->getUser()->twitter) && strlen(trim($post->getUser()->twitter)) > 0)
{
$return[] = '<meta name="twitter:creator" content="@'.$post->getUser()->twitter.'">'."\n";
}
$return[] = '<meta name="twitter:title" content="'.$post->title.'">'."\n";
$return[] = '<meta name="twitter:description" content="'.$description.'">'."\n";
$return[] = '<meta name="twitter:image:src" content="'.$thumbnail.'">'."\n";
}
return $return;
}
public function searchAction()
{
$search = $this->request->getQuery('q');
$this->view->setVar('search', $search);
}
public function singleAction($postID, $slug){
$post = Posts::findFirst(array('conditions'=>"ID='{$postID}' AND status='publish' AND deleted='N'"));
$this->assets->addJs('assets/js/social-share-kit.min.js');
$this->assets->addCss('assets/css/social-share-kit.css');
if($post){
if($slug != $post->slug)
{
$this->response->redirect(array('for'=>'blog-post', 'postID'=>$postID, 'slug'=>$post->slug));
}
$viewed = $this->post_view($post->ID, $this->profileInfo ? $this->profileInfo->ID : 0);
$post->other_posts = Posts::find(
array(
'conditions'=>"user_id='{$post->user_id}' AND status='publish' AND deleted='N'",
'order'=>'published_at DESC',
'limit'=>5
)
);
$post->content = str_replace('http://siberteknoloji.com/post-images', 'https://siberteknoloji.com/post-images', $post->content);
$this->view->setVar('social_meta_tags', $this->SocialMetaTags($post));
$this->view->setVar('page_title', $post->title.' | Yazar: '.$post->getUser()->name);
$this->page_meta['description'] = mb_substr(strip_tags($post->content), 0, 160, "UTF-8");
$setTag = "";
foreach($post->getTags()->toArray() as $key=>$value)
{
$setTag .= $value['tag'].", ";
}
$this->page_meta['keywords'] = $setTag;
$this->view->setVar('page_meta', $this->page_meta);
$this->view->setVar('viewed', $viewed);
$this->view->setVar('post', $post);
}else{
$this->dispatcher->forward(array('controller'=>'index', 'action'=>'notFound'));
}
}
public function pageAction($pageID, $slug){
$page = Pages::findFirst(array('conditions'=>"ID='{$pageID}' AND status='publish' AND deleted='N'"));
if($page){
if($slug != $page->slug)
{
$this->response->redirect(array('for'=>'blog-page', 'pageID'=>$pageID, 'slug'=>$page->slug));
}
$this->view->setVar('page_title', $page->title);
$this->view->setVar('page', $page);
}else{
$this->dispatcher->forward(array('controller'=>'index', 'action'=>'notFound'));
}
}
public function addCommentAction()
{
$this->view->disable();
$data = $this->request->getPost();
$post = Posts::findFirst($data['comment_post']);
if($this->security->checkToken()){
if(trim($data['comment_text']) != '')
{
if(!$this->profileInfo && !filter_var($data['comment_email'], FILTER_VALIDATE_EMAIL)){
$this->flash->error('Email adresinin doğru girilmesi gerekiyor.');
}else{
$zort = array('blog' => 'https://siberteknoloji.com',
'user_ip' => $_SERVER['HTTP_CF_CONNECTING_IP'],
'user_agent' => $this->request->getUserAgent(),
'referrer' => $this->request->getHTTPReferer(),
'permalink' => $this->url->get(array('for'=>'blog-post', 'postID'=>$post->ID, 'slug'=>$post->slug)),
'comment_type' => 'comment',
'comment_author' => $data['comment_name'],
'comment_author_email' => $data['comment_email'],
'comment_author_url' => '',
'comment_content'=> $data['comment_text'],
);
$akismet = new Akismet();
$response = $akismet->commentCheck($zort);
if($response[1] == 'false')
{
$status = $this->profileInfo ? ($this->profileInfo->role == 'editor' ? 'publish' : ($this->profileInfo->ID == $post->user_id ? 'publish':'wait')) : 'wait';
}
else
{
$status = 'spam';
}
$comment = new Comments();
$comment->post_id = $data['comment_post'];
$comment->author = $this->profileInfo ? $this->profileInfo->name : $data['comment_name'];
$comment->author_email = $this->profileInfo ? $this->profileInfo->email : $data['comment_email'];
$comment->author_ip = isset($_SERVER['HTTP_CF_CONNECTING_IP']) ? $_SERVER['HTTP_CF_CONNECTING_IP'] : $_SERVER['REMOTE_ADDR'];
$comment->created_at = date('Y-m-d H:i:s');
$comment->updated_at = null;
$comment->content= htmlspecialchars(trim($data['comment_text']));
$comment->status = $status;
$comment->reply_to = $data['comment_reply'];
$comment->user_id = $this->profileInfo ? $this->profileInfo->ID : 0;
$comment->save();
$this->flash->success('Harika! Yorumun kaydedildi ve kısa süre içerisinde yayınlanacak.');
if($this->profileInfo && $status != 'spam')
{
if($this->profileInfo->role=='editor' || $this->profileInfo->ID == $post->user_id)
{
$post->comment = ((int)$post->comment)+1;
$post->save();
}
}
}
}else{
$this->flash->warning('Lütfen yorumunu göndermeden önce formu eksiksiz doldur.');
}
}
else{
$this->flash->warning('Yorumunuz güvenlik kontrolüne takıldı.');
}
$this->response->redirect(array('for'=>'blog-post-anchor', 'postID'=>$post->ID, 'slug'=>$post->slug, 'anchor'=>'#comment-form'));
}
public function categoryAction($categoryID, $slug, $page=null){
$category = Categories::findFirst($categoryID);
if($category){
if($slug != $category->slug){
$this->response->redirect(array('for'=>'blog-category', 'categoryID'=>$categoryID, 'slug'=>$category->slug));
}else{
$list = Categories::findFirst(array(
'conditions'=>'ID=:id: OR parent=:parent:',
'columns'=>'GROUP_CONCAT(ID) as ID',
'bind'=>array('id'=>$categoryID, 'parent'=>$categoryID)
))->toArray();
$paginator = new Pagination(
array(
"data" => Posts::find(array(
'conditions'=>"category_id IN ({$list['ID']}) AND status='publish' AND deleted='N'",
"order"=>"published_at DESC"
)),
"limit"=> 10,
"page" => $page
)
);
$this->view->setVar('page_title', $category->name.' Kategorisindeki Yazılar');
$this->view->setVar('category', $category);
$this->view->setVar('posts', $paginator->getPaginate());
}
}else{
$this->dispatcher->forward(array('controller'=>'index', 'action'=>'notFound'));
}
}
public function tagAction($slug, $page=null){
$tags = Tags::find(array('conditions'=>"slug='{$slug}'"));
if($tags->count() > 0) {
$arr = array();
foreach($tags as $tag) {
$arr[] = $tag->post_id;
}
$post_ids = implode(',', $arr);
$paginator = new Pagination(
array(
"data" => Posts::find(array(
'conditions'=>"ID IN($post_ids) AND status='publish' AND deleted='N'",
"order"=>"published_at DESC"
)),
"limit"=> 10,
"page" => $page
)
);
$page_tag = $tags->toArray()[0]['tag'];
$this->view->setVar('page_title', '"'.$page_tag.'" Etiketli Yazılar');
$this->view->setVar('tag', $page_tag);
$this->view->setVar('slug', $tags->toArray()[0]['slug']);
$this->view->setVar('posts', $paginator->getPaginate());
}else{
$this->dispatcher->forward(array('controller'=>'index', 'action'=>'notFound'));
}
}
}
|