コード例 #1
0
 public function __construct($infos = false)
 {
     $displayErrors = false;
     if (!self::$pdoS) {
         if (empty($infos)) {
             require ROOT . 'config/bdd.php';
             $infos = $BDD['mysql'];
         }
         $displayErrors = @$infos['displayErrors'];
         try {
             self::$pdoS = new PDO('mysql:host=' . $infos['host'] . ';dbname=' . $infos['database'] . '', $infos['login'], $infos['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''));
             self::$pdoS->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
             $this->wake_up();
             return true;
         } catch (PDOException $erreur) {
             $error = new error();
             if ($displayErrors) {
                 $error->addError('Error : ' . $erreur->getMessage(), ERROR_PAGE);
             } else {
                 $error->addError('We can\'t display the page you asked for.', ERROR_PAGE);
             }
             return false;
         }
     }
     $this->wake_up();
 }
コード例 #2
0
 /**
  * Loads the data for this ViewNode record from the database
  * @return ViewNode object (this)
  */
 function load($style = 'long')
 {
     global $DB, $CFG, $USER, $ERROR, $HUB_FLM, $HUB_SQL;
     try {
         $this->canview();
     } catch (Exception $e) {
         return access_denied_error();
     }
     $params = array();
     $params[0] = $this->viewid;
     $params[1] = $this->nodeid;
     $params[2] = $this->userid;
     $resArray = $DB->select($HUB_SQL->DATAMODEL_VIEWNODE_SELECT, $params);
     if ($resArray !== false) {
         $count = count($resArray);
         if ($count == 0) {
             $ERROR = new error();
             $ERROR->createNodeNotFoundError($this->nodeid);
             return $ERROR;
         } else {
             for ($i = 0; $i < $count; $i++) {
                 $array = $resArray[$i];
                 $this->xpos = stripslashes(trim($array['XPos']));
                 $this->ypos = $array['YPos'];
                 $this->creationdate = $array['CreationDate'];
                 $this->modificationdate = $array['ModificationDate'];
                 $this->node = new CNode($this->nodeid);
                 $this->node = $this->node->load($style);
             }
         }
     } else {
         return database_error();
     }
     return $this;
 }
コード例 #3
0
 function error()
 {
     require 'Controllers/error.php';
     $controller = new error();
     $controller->index();
     return false;
 }
コード例 #4
0
ファイル: captcha.class.php プロジェクト: ksb1712/pragyan
 function captcha($sourceFolder, $moduleFolder, $uploadFolder, $urlRequestRoot, $cmsFolder, $length = 5)
 {
     $this->sourceFolder = $sourceFolder;
     $this->moduleFolder = $moduleFolder;
     $this->uploadFolder = $uploadFolder;
     $this->urlRequestRoot = $urlRequestRoot;
     $this->cmsFolder = $cmsFolder;
     // header('Content-type: image/png');
     $this->Length = $length;
     //$this->fontpath = dirname($_SERVER['SCRIPT_FILENAME']) . '/fonts/';
     global $sourceFolder, $moduleFolder;
     $this->fontpath = "{$sourceFolder}/{$moduleFolder}/form/captcha/fonts/";
     $this->fonts = $this->getFonts();
     $errormgr = new error();
     if ($this->fonts == FALSE) {
         //$errormgr = new error;
         $errormgr->addError('No fonts available!');
         $errormgr->displayError();
         //      	die();
     }
     if (function_exists('imagettftext') == FALSE) {
         $errormgr->addError('');
         $errormgr->displayError();
         //       die();
     }
     $this->stringGen();
     $this->makeCaptcha();
 }
コード例 #5
0
ファイル: miscellaneous.php プロジェクト: ahmed-dinar/JUSTAS
 public static function Error()
 {
     Session::flush('sure', Messages::_404());
     require_once SITE_PATH . '/app/controllers/error_controller.php';
     $control = new error();
     $control->index();
     return FALSE;
 }
コード例 #6
0
ファイル: miscellaneous.php プロジェクト: WWAHIDAADNAN/JUSTAS
 public static function Error()
 {
     Session::flush('sure', '404: Page does not exists!<br/>Are you sure what you are looking for?');
     require_once SITE_PATH . '/app/controllers/error_controller.php';
     $control = new error();
     $control->index();
     return FALSE;
 }
コード例 #7
0
ファイル: controller.php プロジェクト: shalvasoft/MVC
 /**
  * Not have permition to view this page
  */
 public function Not_have_Perm()
 {
     /** @noinspection PhpIncludeInspection */
     require_once controllers_dir() . default_error();
     $err = new error();
     $err->error403();
     exit;
 }
コード例 #8
0
ファイル: news.php プロジェクト: soremi/tutornavi
 public function view()
 {
     // Get URI vars
     $newsID = (int) uri::segment(3);
     // Get news entry
     if (!$newsID || !($news = $this->news_model->getEntry($newsID, 'in_view')) || !$news['active']) {
         error::show404();
     }
     // Do we have views enabled?
     if (config::item('news_views', 'news')) {
         // Update views counter
         $this->news_model->updateViews($newsID);
     }
     // Load ratings
     if (config::item('news_rating', 'news') == 'stars') {
         // Load votes model
         loader::model('comments/votes');
         // Get votes
         $news['user_vote'] = $this->votes_model->getVote('news', $newsID);
     } elseif (config::item('news_rating', 'news') == 'likes') {
         // Load likes model
         loader::model('comments/likes');
         // Get likes
         $news['user_vote'] = $this->likes_model->getLike('news', $newsID);
     }
     // Assign vars
     view::assign(array('newsID' => $newsID, 'news' => $news));
     // Set title
     view::setTitle($news['data_title']);
     // Set meta tags
     view::setMetaDescription($news['data_meta_description']);
     view::setMetaKeywords($news['data_meta_keywords']);
     // Load view
     view::load('news/view');
 }
コード例 #9
0
ファイル: core.php プロジェクト: istobran/Tieba_Sign
function template($file)
{
    global $template_loaded;
    $template_loaded = false;
    HOOK::run(str_replace('/', '_', "template_load_{$file}"));
    $template_name = defined('IN_ADMINCP') ? 'default' : getSetting('template');
    if (IN_MOBILE) {
        $mobilefile = ROOT . "./template/{$template_name}/mobile/{$file}.php";
        if (file_exists($mobilefile)) {
            return $mobilefile;
        }
        $mobilefile_default = ROOT . "./template/default/mobile/{$file}.php";
        if (file_exists($mobilefile_default)) {
            return $mobilefile_default;
        }
    }
    $path = ROOT . "./template/{$template_name}/{$file}.php";
    if (file_exists($path)) {
        return $path;
    }
    $path = ROOT . "./template/default/{$file}.php";
    if (file_exists($path)) {
        return $path;
    }
    error::system_error("Missing template '{$file}'.");
}
コード例 #10
0
ファイル: forum.inc.php プロジェクト: BackupTheBerlios/k4bb
 /**
  * Forum_Controller constructor
  * @param string template	The base template to use for
  *							the specific page.
  */
 function Forum_Controller($template)
 {
     /* Globalize the settings and config arrays */
     global $_SETTINGS, $_USERGROUPS, $_ALLFORUMS;
     /* Make sure the default event class exists */
     if (!class_exists('DefaultEvent')) {
         exit('Yahtzee!');
     }
     /* Call the Controller Constructor */
     parent::Controller(new DefaultEvent());
     /* Create a new instance of Template */
     error::reset();
     $this->template =& new Template($template);
     if (error::grab()) {
         critical_error();
     }
     /* Set all of the setting values to the template */
     $this->template->setVarArray($_SETTINGS);
     /* Set the Jump To Box */
     $jump_to =& new AllForumsIterator($_ALLFORUMS);
     $this->template->setList('all_forums', $jump_to);
     /* Add the usergroups to the template */
     $usergroups =& new FAArrayIterator($_USERGROUPS);
     $this->template->setList('usergroups', $usergroups);
 }
コード例 #11
0
 /**
  * Provides the services/data_utils/bulk_verify service. This takes a report plus params (json object) in the $_POST
  * data and verifies all the records returned by the report according to the filter. Pass ignore=true to allow this to 
  * ignore any verification check rule failures (use with care!).
  */
 public function bulk_verify()
 {
     $db = new Database();
     $this->authenticate('write');
     $report = $_POST['report'];
     $params = json_decode($_POST['params'], true);
     $params['sharing'] = 'verification';
     $websites = $this->website_id ? array($this->website_id) : null;
     $this->reportEngine = new ReportEngine($websites, $this->user_id);
     try {
         // Load the report used for the verification grid with the same params
         $data = $this->reportEngine->requestReport("{$report}.xml", 'local', 'xml', $params);
         // now get a list of all the occurrence ids
         $ids = array();
         foreach ($data['content']['records'] as $record) {
             if ($record['record_status'] !== 'V' && (!empty($record['pass']) || $_POST['ignore'] === 'true')) {
                 $ids[$record['occurrence_id']] = $record['occurrence_id'];
                 $db->insert('occurrence_comments', array('occurrence_id' => $record['occurrence_id'], 'comment' => 'This record is assumed to be correct', 'created_by_id' => $this->user_id, 'created_on' => date('Y-m-d H:i:s'), 'updated_by_id' => $this->user_id, 'updated_on' => date('Y-m-d H:i:s')));
             }
         }
         $db->from('occurrences')->set(array('record_status' => 'V', 'verified_by_id' => $this->user_id, 'verified_on' => date('Y-m-d H:i:s'), 'updated_by_id' => $this->user_id, 'updated_on' => date('Y-m-d H:i:s')))->in('id', array_keys($ids))->update();
         echo count($ids);
         $db->from('cache_occurrences')->set(array('record_status' => 'V', 'cache_updated_on' => date('Y-m-d H:i:s')))->in('id', array_keys($ids))->update();
     } catch (Exception $e) {
         echo $e->getMessage();
         error::log_error('Exception during bulk verify', $e);
     }
 }
コード例 #12
0
 /**
  * Function to support the services/data_cleaner/verify web-service. 
  * Receives a list of proposed records and applies verification rules to them, then
  * returns a list of verification notices.
  * Input is provided in the $_GET or $_POST data sent to the method as follows:
  * auth_token - read authorisation token
  * nonce - read nonce
  * sample - Provides details of the sample being verified. If verifying a list
  * of records from different places or dates then the sample entry can be ommitted or only partially
  * filled-in with the missing information provided on a record by record bases. A JSON formatted
  * object with entries for sample:survey_id, sample:date, sample:entered_sref and sample:entered_sref_system, plus 
  * optional sample:geom (WKT format).
  * occurrences - JSON format, provide an array of the occurrence record to verify. Each record is an object
  * with occurrence:taxa_taxon_list_id, an optional stage plus any of the values for the sample which need to be 
  * specified on a record by record bases. I.e. provide sample:date if the sample information sent
  * does not include a date, or a date is included but this record is for a different date.
  * rule_types - JSON formatted array of the rule types to run. If not provided, then all rule types are run.
  * E.g. ["WithoutPolygon","PeriodWithinYear"] to run just without polygon and period within year checks.
  * @return JSON A JSON array containing a list of notifications. Each notification is a JSON
  * object, with taxa_taxon_list_id and message properties.
  */
 public function verify()
 {
     // authenticate requesting website for this service
     $this->authenticate('read');
     if (isset($_REQUEST['sample'])) {
         $sample = json_decode($_REQUEST['sample'], true);
     }
     if (isset($_REQUEST['occurrences'])) {
         $occurrences = json_decode($_REQUEST['occurrences'], true);
     }
     if (empty($sample) || empty($occurrences)) {
         $this->response = 'Invalid parameters';
     } else {
         $db = new Database();
         // Create an empty template table
         $db->query("select * into temporary occdelta from cache_occurrences limit 0;");
         try {
             $this->prepareOccdelta($db, $sample, $occurrences);
             $r = $this->runRules($db);
             $db->query('drop table occdelta');
             $this->content_type = 'Content-Type: application/json';
             $this->response = json_encode($r);
         } catch (Exception $e) {
             $db->query('drop table occdelta');
             $this->response = "Query failed";
             error::log_error('Error occurred calling verification rule service', $e);
         }
     }
     $this->send_response();
 }
コード例 #13
0
ファイル: blocked.php プロジェクト: soremi/tutornavi
 public function delete()
 {
     // Get URI vars
     $slugID = urldecode(utf8::trim(uri::segment(4)));
     // Do we have a slug ID?
     if ($slugID == '') {
         error::show404();
     }
     // Get user
     if (!($user = $this->users_model->getUser($slugID)) || !$user['active'] || !$user['verified']) {
         error::show404();
     } elseif ($user['user_id'] == session::item('user_id')) {
         router::redirect($user['slug']);
     }
     // Does user exist?
     if (!($blocked = $this->users_blocked_model->getUser($user['user_id'], true))) {
         view::setError(__('no_blocked_user', 'users_blocked'));
         router::redirect('users/blocked');
     }
     // Delete blocked user
     $this->users_blocked_model->deleteBlockedUser(session::item('user_id'), $user['user_id']);
     // Success
     view::setInfo(__('user_unblocked', 'users_blocked'));
     router::redirect(input::get('page') ? 'users/blocked' : $user['slug']);
 }
コード例 #14
0
ファイル: application.php プロジェクト: s-kalaus/ekernel
 public function run_controller($in_action = false)
 {
     // Инициализируем класс контроллера
     $class = 'controller_' . $this->request->controller;
     if (!class_exists($class) && $this->config->fallback_controller) {
         $class = 'controller_' . $this->config->fallback_controller;
     }
     if (!class_exists($class)) {
         if ($in_action) {
             $class = 'controller_error';
         } else {
             error::call('Not Found', 404);
         }
     }
     $this->controller = new $class($this->request, $this->response);
     ob_start();
     $this->plugin_action('controller_before');
     // Хук, до выполнения экшена контроллера
     $this->controller->before();
     // Запускаем основной экшн
     $action = $this->request->action . '_action';
     $this->controller->{$action}($this->request->param);
     $this->plugin_action('controller_after');
     // Хук, после выполнения экшена контроллера
     $this->controller->after();
     // Запускаем ренедер контента
     $this->controller->render();
     $this->plugin_action('controller_render');
 }
コード例 #15
0
ファイル: nxd_config.php プロジェクト: nextdo/Next-Do
function nxd_check_config($item)
{
    if (!isset($GLOBALS['nxd_config'][$item])) {
        return error::instance()->fatal('Missing configuration item requested', $item);
    }
    return $GLOBALS['nxd_config'][$item];
}
コード例 #16
0
ファイル: email.php プロジェクト: soremi/tutornavi
 public function sendTemplate($keyword, $email, $tags = array(), $language = '')
 {
     loader::model('system/emailtemplates');
     if (!$language) {
         $language = config::item('language_id', 'system');
     }
     if (is_numeric($language)) {
         $language = config::item('languages', 'core', 'keywords', $language);
     } elseif (!in_array($language, config::item('languages', 'core', 'keywords'))) {
         return false;
     }
     if (!($template = config::item($keyword . '_' . $language, '_system_emails_cache'))) {
         if (!($template = $this->cache->item('core_email_template_' . $keyword . '_' . $language))) {
             $template = $this->emailtemplates_model->prepareTemplate($keyword, $language);
             if (count($template) == 3) {
                 if ($template[$keyword]['active']) {
                     $template = array('subject' => $template[$keyword]['subject'], 'message_html' => utf8::trim($template['header']['message_html'] . $template[$keyword]['message_html'] . $template['footer']['message_html']), 'message_text' => utf8::trim($template['header']['message_text'] . "\n\n" . $template[$keyword]['message_text'] . "\n\n" . $template['footer']['message_text']));
                 } else {
                     $template = 'none';
                 }
             } else {
                 error::show('Could not fetch email template from the database: ' . $keyword);
             }
             $this->cache->set('core_email_template_' . $keyword . '_' . $language, $template, 60 * 60 * 24 * 30);
         }
         config::set(array($keyword . '_' . $language => $template), '', '_system_emails_cache');
     }
     $retval = true;
     if (is_array($template) && $template) {
         $retval = $this->sendEmail($email, $template['subject'], $template['message_text'], $template['message_html'], $tags);
     }
     return $retval;
 }
コード例 #17
0
ファイル: set.php プロジェクト: vahitserifsaglam1/ozsa-src
 public static function ObjectToArray($object)
 {
     if (is_object($object)) {
         return (array) $object;
     } else {
         error::newError("HATA : {$object} bir obje değil");
     }
 }
コード例 #18
0
ファイル: notices.php プロジェクト: soremi/tutornavi
 public function __construct()
 {
     parent::__construct();
     if (!config::item('timeline_active', 'timeline') || !users_helper::isLoggedin()) {
         error::show404();
     }
     loader::model('timeline/notices', array(), 'timeline_notices_model');
 }
コード例 #19
0
ファイル: pager.php プロジェクト: snickers54/dblink
 /**
  * @fn function setDatas($data)
  * @brief set all datas (array) in the class pager
  * @file pager.php
  * 
  * @param data                
  * @return		
  */
 public function setDatas($data)
 {
     if (!is_array($data)) {
         error::errorPager();
         return;
     }
     $this->result = $data;
 }
コード例 #20
0
ファイル: Form.php プロジェクト: vahitserifsaglam1/ozsa-src
 public static function makro($name, $return)
 {
     if (is_callable($return)) {
         self::$functions[$name] = Closure::bind($return, null, get_class());
     } else {
         error::newError("{$name} e atadığınız fonksiyon çağrılabilir bir fonksiyon değildir");
     }
 }
コード例 #21
0
ファイル: YAZ.php プロジェクト: Alambos/books
 static function is_error()
 {
     if ($e = yaz_error(self::$connection)) {
         error::add('Błąd YAZ: ' . $e);
     } else {
         return FALSE;
     }
 }
コード例 #22
0
ファイル: error.php プロジェクト: kydreth/BreathePHP
 public static function Ret()
 {
     $class = __CLASS__;
     if (!self::$SINGLETON) {
         self::$SINGLETON = new $class();
     }
     return self::$SINGLETON;
 }
コード例 #23
0
ファイル: helper.php プロジェクト: Ermile/Saloos
 public function __call($name, $args)
 {
     $class_name = "helper\\{$name}";
     if (!class_exists($class_name)) {
         \error::page("helper {$name} not found");
     } else {
         return new $class_name($args);
     }
 }
コード例 #24
0
ファイル: pager.php プロジェクト: alex-min/melondoc
 /**
  * @fn function setDatas($data)
  * @brief set all datas (array) in the class pager
  * @file pager.php
  * 
  * @param data                
  * @return		
  */
 public function setDatas($data)
 {
     if (!is_array($data)) {
         $this->KLogger->logFatal("[PAGER] data's type is not an array.");
         error::errorPager();
         return;
     }
     $this->result = $data;
 }
コード例 #25
0
ファイル: feedback.php プロジェクト: soremi/tutornavi
 public function __construct()
 {
     parent::__construct();
     if (!config::item('feedback_active', 'feedback')) {
         error::show404();
     } elseif (!session::permission('feedback_access', 'feedback')) {
         view::noAccess();
     }
     loader::model('feedback/feedback');
 }
コード例 #26
0
ファイル: convert.php プロジェクト: Alambos/books
 static function ISBN13_to_ISBN10($kod)
 {
     validate::EAN($kod);
     if (substr($kod, 0, 3) == '978') {
         $kod = substr($kod, 3, 9);
         return strtoupper($kod . checksum::ISBN($kod));
     } else {
         error::add('Kodu ISBN-13 ' . $kod . ' nie można zamienić na ISBN-10!');
     }
 }
コード例 #27
0
ファイル: db.php プロジェクト: AshleyJSheridan/tweed
 public static function table($table)
 {
     $q = \maverick\query::getInstance(true);
     if (!strlen($table)) {
         error::log('Table not specified', true);
     } else {
         $q->set_from_table($table);
     }
     return $q;
 }
コード例 #28
0
ファイル: router.php プロジェクト: kydreth/BreathePHP
 public function Run()
 {
     if (layout::Ret()->Ready() and $this->output) {
         $this->output .= layout::Ret()->Display();
         error::Ret()->Warn("Output found from action - " . stack::Ret()->GetAction() . " - and layout - " . layout::Ret()->GetTemplate());
     } elseif (layout::Ret()->Ready()) {
         $this->output = layout::Ret()->Display();
     }
     return $this->output;
 }
コード例 #29
0
ファイル: report.php プロジェクト: soremi/tutornavi
 public function __construct()
 {
     parent::__construct();
     if (!config::item('reports_active', 'reports')) {
         error::show404();
     } elseif (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     }
     loader::model('reports/reports');
     loader::model('reports/subjects', array(), 'reports_subjects_model');
 }
コード例 #30
0
ファイル: visitors.php プロジェクト: soremi/tutornavi
 public function __construct()
 {
     parent::__construct();
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!config::item('visitors_active', 'users')) {
         error::show404();
     }
     loader::model('users/visitors', array(), 'users_visitors_model');
 }