| #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/UserController.php (15) <?php
namespace Yazar\Blog\Controllers;
use Yazar\Shared\Controllers\ControllerBase;
use Yazar\Shared\Models\Users as Users;
use Yazar\Shared\Models\UsersMeta as UsersMeta;
use Yazar\Shared\Models\Posts as Posts;
use Yazar\Shared\Models\Comments as Comments;
use \Phalcon\Paginator\Adapter\Model as Pagination;
class UserController extends ControllerBase {
public function initialize() {
parent::initialize();
}
public function profileAction($nick,$page=null){
$user = Users::findFirst(array('conditions'=>"nick='{$nick}'"));
if($user)
{
$paginator = new Pagination(
array(
"data" => Posts::find(array(
'conditions'=>"user_id='{$user->ID}' AND status='publish' AND deleted='N'",
"order"=>"created_at DESC"
)),
"limit"=> 5,
"page" => $page
)
);
$this->view->setVar('page_title', $user->name ." | Yazar Profil Sayfası");
$this->view->setVar('posts_active', $page > 0 ? true : false);
$this->view->setVar('user', $user);
$this->view->setVar('posts', $paginator->getPaginate());
$this->view->setVar('view_count', Posts::sum(array('column'=>'view', 'conditions'=>"user_id='{$user->ID}'")));
$this->view->setVar('comment_count', Posts::sum(array('column'=>'comment', 'conditions'=>"user_id='{$user->ID}'")));
$this->view->setVar('commented_count', Comments::count(array('conditions'=>"user_id='{$user->ID}'")));
$this->view->setVar('friends', (new Users)->getUsersFriends($user->ID));
}
else
{
$this->dispatcher->forward(array('controller'=>'index', 'action'=>'notFound'));
}
}
}
|