예제 #1
0
 public static function run()
 {
     // INI AYARLAR YAPILANDIRILIYOR...
     $iniSet = Config::get('Ini', 'settings');
     if (!empty($iniSet)) {
         Config::iniSet($iniSet);
     }
     // ----------------------------------------------------------------------
     // HTACCESS DOSYASI OLUŞTURULUYOR...
     if (Config::get('Htaccess', 'createFile') === true) {
         createHtaccessFile();
     }
     // ----------------------------------------------------------------------
     // COMPOSER DOSYASI OLUŞTURULUYOR...
     $composer = Config::get('Composer', 'autoload');
     if ($composer === true) {
         $path = 'vendor/autoload.php';
         if (file_exists($path)) {
             require_once $path;
         } else {
             report('Error', getMessage('Error', 'fileNotFound', $path), 'AutoloadComposer');
             die(getErrorMessage('Error', 'fileNotFound', $path));
         }
     } elseif (file_exists($composer)) {
         require_once $composer;
     } elseif (!empty($composer)) {
         report('Error', getMessage('Error', 'fileNotFound', $composer), 'AutoloadComposer');
         die(getErrorMessage('Error', 'fileNotFound', $composer));
     }
     // ----------------------------------------------------------------------
 }
예제 #2
0
파일: Page.php 프로젝트: alfonkdp/soad
 /** List All Page
  *
  * @param string Page slug
  */
 function page_list()
 {
     $data['PageTitle'] = "Page";
     $data['listPage'] = $this->mpage->getAllPage();
     $data['message'] = getMessage($this->uri->segment(4));
     $this->load->admin_template('admin/page_list', $data);
 }
 /**
  * Função para ligar uma variável a um valor
  * @param string $campo
  * @param string $valor
  * @param string $tipo (STRING = DEFAULT, NULL, INT, STRING, BLOB)
  * param CONSTANTES $tipo
  * Tipos constantes:
  * Os tipos são:
  * "BOOLEAN"    ->  PDO::PARAM_BOOL  (integer)
  * Representa um tipo de dados booleano.
  * "NULL"       ->  PDO::PARAM_NULL (integer)
  * Representa um tipo de dados nulo.
  * "INT"        ->  PDO::PARAM_INT (integer)
  * Representa o um tipo de dado inteiro
  * "STRING      -> PDO::PARAM_STR (integer)
  * Representa o CHAR, VARCHAR, ou outros tipos de dados string.
  * "BLOB"       -> PDO::PARAM_LOB (integer)
  * Representa o tipo de dado BLOB - Binary Large Objects
  * param int Tamanho
  */
 public function liga($campo, $valor, $tipo = "STRING")
 {
     /*
      * Ajusto o tipo da variáveL
      */
     switch (strtoupper($tipo)) {
         case "BOOLEAN":
             $tp = PDO::PARAM_BOOL;
             break;
         case "NULL":
             $tp = PDO::PARAM_NULL;
             break;
         case "INT":
             $tp = PDO::PARAM_INT;
             break;
         case "BLOB":
             $tp = PDO::PARAM_LOB;
             break;
         default:
             $tp = PDO::PARAM_STR;
             break;
     }
     /* Tento ligar um valor ao parâmetro */
     Depurar::reg("Parametro: {$campo} Tipo:{$tipo} Valor:{$valor}");
     try {
         $this->resultado->bindValue(":" . $campo, $valor, $tp);
         //echo "liguei :{$campo} a {$valor}";
     } catch (PDOException $e) {
         die($e - getMessage());
     }
 }
예제 #4
0
 public function save($resource)
 {
     try {
         //se if its update or new
         if ($resource->getId() == 0) {
             //set all inputs
             $this->db->set('name', $resource->getName());
             $this->db->set('description', $resource->getDescription());
             $this->db->set('created', time());
             $this->db->insert('resources');
             $affectedRows = $this->db->affected_rows();
             if (is_null($affectedRows) or $affectedRows == 0) {
                 log_message('error', 'Resource_model::save - Could not create resource' . $resource->getName());
                 throw new Exception('Could not create resource!');
             }
         } else {
             $this->db->where('id', $resource->getId());
             $this->db->update('resources', $resource);
             $affectedRows = $this->db->affected_rows();
             if (is_null($affectedRows) or $affectedRows == 0) {
                 log_message('error', 'Resource_model::save - Could not update resource' . $resource->getName());
                 throw new Exception('Could not update resource!');
             }
         }
     } catch (Exception $err) {
         die($err - getMessage());
     }
 }
예제 #5
0
 public function run($functionName = '', $functionRun = '')
 {
     $datas = Structure::datas();
     $parameters = $datas['parameters'];
     $isFile = $datas['isFile'];
     $function = $datas['function'];
     if (file_exists($isFile)) {
         if ($functionName === $function) {
             if (is_callable($functionRun)) {
                 if (APP_TYPE === 'local') {
                     set_error_handler('Exceptions::table');
                 }
                 call_user_func_array($functionRun, $parameters);
                 if (APP_TYPE === 'local') {
                     restore_error_handler();
                 }
             } else {
                 // Sayfa bilgisine erişilemezse hata bildir.
                 if (!Config::get('Route', 'show404')) {
                     // Hatayı ekrana yazdır.
                     echo Error::message('Error', 'callUserFuncArrayError', $functionRun);
                     // Hatayı rapor et.
                     report('Error', getMessage('Error', 'callUserFuncArrayError'), 'SystemCallUserFuncArrayError');
                     // Çalışmayı durdur.
                     return false;
                 } else {
                     redirect(Config::get('Route', 'show404'));
                 }
             }
         }
     }
 }
예제 #6
0
 public function connect($config = array())
 {
     $this->config = $config;
     if (strstr($this->config['driver'], '->')) {
         $subdrivers = explode('->', $this->config['driver']);
         $this->select_driver = $subdrivers[1];
     }
     if (empty($this->select_driver)) {
         $this->select_driver = 'mysql';
     }
     if (!in_array($this->select_driver, $this->pdo_subdrivers)) {
         die(getMessage('Database', 'driverError', $this->select_driver));
     }
     $this->connect = $this->_sub_drivers($this->config['user'], $this->config['password']);
     // Mysql için karakterseti sorguları
     if ($this->select_driver === 'mysql') {
         if (!empty($this->config['charset'])) {
             $this->connect->exec("SET NAMES '" . $this->config['charset'] . "'");
         }
         if (!empty($this->config['charset'])) {
             $this->connect->exec('SET CHARACTER SET ' . $this->config['charset']);
         }
         if (!empty($this->config['collation'])) {
             $this->connect->exec("SET COLLATION_CONNECTION = '" . $this->config['collation'] . "'");
         }
     }
 }
예제 #7
0
 /** List All Category Article
  *
  * @param string Category slug
  */
 public function category_list()
 {
     $data['title'] = "Admin Category List";
     $data['listCategory'] = $this->mcatarticle->getAllCategories();
     $data['message'] = getMessage($this->uri->segment(4));
     $this->load->admin_template('admin/category_article_list', $data);
 }
예제 #8
0
파일: Article.php 프로젝트: alfonkdp/soad
 /** List All Article
  *
  * @param string Article slug
  */
 function article_list()
 {
     $data['PageTitle'] = "Article";
     $data['listArticle'] = $this->marticle->getAllArticle();
     $data['categories'] = $this->mcatarticle->getAllCategories();
     $data['message'] = getMessage($this->uri->segment(4));
     $this->load->admin_template('admin/article_list', $data);
 }
예제 #9
0
 /**
  * adds the link for the connect param
  * @since 1.7.3
  * @param  $user pass-by-reference
  * @return void
  */
 private function getUserLink(&$user)
 {
     $username = KunenaFactory::getUser($user['userid'])->getName();
     if ($user['leapcorrection'] == $this->timeo->format('z', true) + 1) {
         $subject = getSubject($username);
         $db = JFactory::getDBO();
         $query = "SELECT id,catid,subject,time as year FROM #__kunena_messages WHERE subject='{$subject}'";
         $db->setQuery($query, 0, 1);
         $post = $db->loadAssoc();
         if ($db->getErrorMsg()) {
             KunenaError::checkDatabaseError();
         }
         $catid = $this->params->get('bcatid');
         $postyear = new JDate($post['year'], $this->soffset);
         if (empty($post) && !empty($catid) || !empty($post) && !empty($catid) && $postyear->format('Y', true) < $this->timeo->format('Y', true)) {
             $botname = $this->params->get('swkbbotname', JText::_('SW_KBIRTHDAY_FORUMPOST_BOTNAME_DEF'));
             $botid = $this->params->get('swkbotid');
             $time = CKunenaTimeformat::internalTime();
             //Insert the birthday thread into DB
             $query = "INSERT INTO #__kunena_messages (catid,name,userid,email,subject,time, ip)\n\t\t    \t\tVALUES({$catid},'{$botname}',{$botid}, '','{$subject}', {$time}, '')";
             $db->setQuery($query);
             $db->query();
             if ($db->getErrorMsg()) {
                 KunenaError::checkDatabaseError();
             }
             //What ID get our thread?
             $messid = (int) $db->insertID();
             //Insert the thread message into DB
             $message = getMessage($username);
             $query = "INSERT INTO #__kunena_messages_text (mesid,message)\n                    VALUES({$messid},'{$message}')";
             $db->setQuery($query);
             $db->query();
             if ($db->getErrorMsg()) {
                 KunenaError::checkDatabaseError();
             }
             //We know the thread ID so we can update the parent thread id with it's own ID because we know it's
             //the first post
             $query = "UPDATE #__kunena_messages SET thread={$messid} WHERE id={$messid}";
             $db->setQuery($query);
             $db->query();
             if ($db->getErrorMsg()) {
                 KunenaError::checkDatabaseError();
             }
             // now increase the #s in categories
             CKunenaTools::modifyCategoryStats($messid, 0, $time, $catid);
             $user['link'] = CKunenaLink::GetViewLink('view', $messid, $catid, '', $username);
             $uri = JFactory::getURI();
             if ($uri->getVar('option') == 'com_kunena') {
                 $app =& JFactory::getApplication();
                 $app->redirect($uri->toString());
             }
         } elseif (!empty($post)) {
             $user['link'] = CKunenaLink::GetViewLink('view', $post['id'], $post['catid'], '', $username);
         }
     } else {
         $user['link'] = CKunenaLink::GetProfileLink($user['userid']);
     }
 }
예제 #10
0
파일: advisor.php 프로젝트: nikilster/I
function motivateUser($user, $activity)
{
    //TODO: add more messages!
    $message = getMessage($user, $activity);
    //Send Push
    sendPush($message, $user->pushToken);
    //Log
    logMotivation($user, $activity, $message);
}
예제 #11
0
function sendMail($email, $subject, $msg)
{
    if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $header = "From: no-reply@nacossunn.org\r\n" . "Content-type: text/html\r\n" . "X-Mailer: PHP/" . phpversion();
        return mail($email, $subject, wordwrap(getMessage($msg), 70), $header);
    } else {
        return false;
    }
}
예제 #12
0
 public function connect($http_host = HTTP_HOST, $user = DB_USER, $user_password = DB_PASSWORD, $db_host = DB_HOST)
 {
     try {
         $this->_objPDO = new PDO($db_host . ':host=' . $http_host, $user, $user_password, $this->_pdoOption);
     } catch (PDOException $e) {
         new DExceptions($e - getMessage(), $e->getCode());
     }
     return $this->_objPDO;
 }
예제 #13
0
 protected function checkRequestOrder()
 {
     $order = ini_get('request_order');
     if (!$order || !in_array($order, array('GP', 'PG'), true)) {
         $this->addUnformattedDetailError('SECURITY_SITE_CHECKER_PHP_REQUEST_ORDER', CSecurityCriticalLevel::MIDDLE, getMessage('SECURITY_SITE_CHECKER_PHP_REQUEST_ORDER_ADDITIONAL', array('#CURRENT#' => $order, '#RECOMMENDED#' => 'GP')));
         return self::STATUS_FAILED;
     }
     return self::STATUS_PASSED;
 }
예제 #14
0
function get_plural_messages($prefix)
{
    global $MESS;
    $result = array();
    $k = 0;
    while ($form = getMessage($prefix . 'PLURAL_' . ++$k)) {
        $result[] = $form;
    }
    return $result;
}
예제 #15
0
 function __construct($serverURL = 'localhost:9000', $serverPath = '/')
 {
     $this->serverURL = $serverURL;
     $this->serverPath = $serverPath;
     try {
         $this->client = new XML_RPC_Client($this->serverPath, $this->serverURL);
     } catch (Exception $e) {
         echo "<h4>Error creating XMLRPC client: " . $e . getMessage() . "</h4>";
         exit;
     }
 }
예제 #16
0
파일: Atlet.php 프로젝트: alfonkdp/soad
 /** List All Atlet
  *
  * @param string Atlet slug
  */
 function atlet_list()
 {
     $data['PageTitle'] = "Atlet";
     $data['listAtlet'] = $this->matlet->getAllAtlet();
     //require_once(APPPATH. 'libraries/PhpGrid_Lite/conf.php'); // APPPATH is path to application folder
     $this->load->library('ci_phpgrid');
     $data['phpgrid'] = $this->ci_phpgrid->example_method(3);
     //$data['phpgrid'] = new C_DataGrid("SELECT * FROM clients"); //$this->ci_phpgrid->example_method(3);
     $data['message'] = getMessage($this->uri->segment(4));
     $this->load->admin_template('admin/atlet_list', $data);
 }
 public function delete($id)
 {
     try {
         $client = parent::find($id);
         parent::delete($id);
         return ['success' => true];
     } catch (ModelNotFoundException $ex) {
         return ['success' => false, 'message' => 'O id ' . $id . ' nao foi localizado!', 'error' => $ex->getMessage()];
     } catch (Exception $ex2) {
         return ['success' => false, 'message' => 'Erro ao excluir client: ' + $ex2 . getMessage(), 'error' => $ex2->getMessage()];
     }
 }
function deletePerson($id)
{
    $sql = "delete from person where id = :id";
    try {
        $db = getConnection();
        $stmt = $db->prepare($sql);
        $stmt->bindParam('id', $id);
        $stmt->execute();
    } catch (PDOException $e) {
        echo $e . getMessage();
    }
}
예제 #19
0
 public function getCommentBlog()
 {
     // Connect to Database
     try {
         $sql = "SELECT contact_id, first_name, last_name, email, phone, street city, state, zip_code, comment FROM contact WHERE contact_id != 0 ORDER BY contact_id";
         $result = $this->conn->query($sql);
         return $result;
     } catch (PDOException $error) {
         echo "Unable to retrieve record(s): " . $error - getMessage();
         exit;
     }
 }
예제 #20
0
function getMailInstanse($cfg, $query, $orderID)
{
    # PHPmailer instanse
    $mail = new PHPMailer();
    # General settings email
    $mail->CharSet = 'UTF-8';
    $mail->setFrom("robot@{$cfg['domain']}", $cfg['title']);
    $mail->addReplyTo("support@{$cfg['domain']}");
    $mail->isHTML(true);
    $mail->Subject = "Заявка #{$orderID}";
    $mail->Body = getMessage($cfg, $query, $orderID);
    return $mail;
}
예제 #21
0
 function retXmlHttpCall($opposite_address)
 {
     $queryXml = null;
     $objH = new HttpClientUtil();
     try {
         $queryXml = $objH->httpClientCall($this->getURL($opposite_address), $this->getInputCharset());
     } catch (Exception $e) {
         throw new SDKRuntimeException("http请求失败:" + $e . getMessage());
     } catch (SDKRuntimeException $e) {
         die($e->errorMessage());
     }
     $xmlParse = new XmlParseUtil();
     return $xmlParse->openapiXmlToMap($queryXml, $this->getInputCharset());
 }
예제 #22
0
    public function register($post)
    {
        try {
            $this->q = 'insert into user (id, email, passwd, fullname, status, level) 
						values (null, :email, :passwd, :full, 1, :lvl)';
            $data = array(':email' => $post['email'], ':passwd' => md5($post['passwd']), ':full' => $post['fullname'], ':lvl' => $post['level']);
            $ps = $this->db->prepare($this->q);
            $ps->execute($data);
        } catch (PDOException $e) {
            echo $e . getMessage();
            return false;
        }
        return true;
    }
예제 #23
0
 public function realizarAccion($accion)
 {
     $this->realizarConexion();
     try {
         $prepare = $this->con->prepare($accion);
         $prepare->execute();
         $this->cerrarConexion();
         return $prepare->fetchAll(PDO::FETCH_ASSOC);
     } catch (PDOException $e) {
         print "¡Error!: " . $e . getMessage() . "<br/>";
         $this->cerrarConexion();
         die;
     }
 }
예제 #24
0
 public function pre_process($person)
 {
     parent::pre_process($person);
     $authvar = "";
     $csr = null;
     if (isset($_POST['signCSR'])) {
         $this->signCSR(Input::sanitizeCertKey($_POST['signCSR']));
         return;
     }
     /* Testing for uploaded files */
     if (isset($_FILES['user_csr']['name'])) {
         try {
             $csr = CSRUpload::receiveUploadedCSR('user_csr', true);
         } catch (FileException $fileEx) {
             $msg = $this->translateTag('l10n_err_csrproc', 'processcsr');
             Framework::error_output($msg . $fileEx->getMessage());
             $this->csr = null;
             return;
         }
     } else {
         if (isset($_POST['user_csr'])) {
             try {
                 $csr = CSRUPload::receivePastedCSR('user_csr');
             } catch (ConfusaGenException $cge) {
                 $msg = $this->translateTag('l10n_err_no_csr', 'processcsr');
                 Framework::error_output($msg . $cg - e > getMessage());
                 $this->csr = null;
                 return;
             }
         } else {
             /* No CSR present, neither paste nor file, kindly bump user */
             Framework::error_output($this->translateTag('l10n_err_no_csr', 'processcsr'));
             return;
         }
     }
     if (!$csr->isValid()) {
         $msg = $this->translateTag('l10n_err_csrinvalid1', 'processcsr');
         $msg .= Config::get_config('min_key_length');
         $msg .= $this->translateTag('l10n_err_csrinvalid2', 'processcsr');
         Framework::error_output($msg);
         $this->csr = null;
         return;
     }
     if (Config::get_config('ca_mode') == CA_COMODO || match_dn($csr->getSubject(), $this->ca->getFullDN())) {
         $csr->setUploadedDate(date("Y-m-d H:i:s"));
         $csr->setUploadedFromIP($_SERVER['REMOTE_ADDR']);
         $csr->storeDB($this->person);
         $this->csr = $csr;
     }
 }
예제 #25
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $logger = $this->getContainer()->get('export.logger');
     echo "Send a test mail";
     $templatingService = $this->getContainer()->get('templating');
     $testMail = \Swift_Message::newInstance()->setSubject("Contact – question inscription en cours")->setFrom("*****@*****.**")->setTo("*****@*****.**")->setBody($templatingService->render('WekaLeadsExportBundle:Emails:Comundi/contact.html.twig', array('content' => "test de contenu", 'mail_contact' => "*****@*****.**", 'tel' => "0681428259", 'user_data' => ['firstName' => 'firstName', 'lastName' => 'LastName'])), 'text/html')->addPart($templatingService->render('WekaLeadsExportBundle:Emails:Comundi/contact.txt.twig', array('content' => "test de contenu", 'mail_contact' => "*****@*****.**", 'tel' => "0681428259", 'user_data' => ['firstName' => 'firstName', 'lastName' => 'LastName'])), 'text/plain');
     $testMail->addBcc("*****@*****.**");
     try {
         $this->getContainer()->get('mailer')->send($testMail);
         $logger->info('****** Envoi du mail TEST réussi ! ******');
     } catch (\Exception $e) {
         echo "Erreur !!!! " . $e - getMessage();
     }
 }
예제 #26
0
 public function veriflyAction()
 {
     switch ($this->request->getPost('type')) {
         case "login":
             break;
         case "register":
             $this->tag->setTitle('注册中。。。');
             $username = $this->request->getPost('username');
             $email = $this->request->getPost("email");
             if (CheckController::usernameCheck($username)) {
                 $errmsg .= "用户名已存在辣~";
             }
             if (CheckController::emailCheck($email)) {
                 $errmsg .= "邮箱已经被使用辣~";
             }
             if (!$errmsg) {
                 $token = md5($username . $username . $regtime);
                 //创建用于激活识别码
                 $token_exptime = time() + 60 * 60 * 24;
                 //过期时间为24小时后
                 $user = new UserAccount();
                 $user->username = $username;
                 //用户名
                 $user->email = $email;
                 //邮箱
                 $user->regtime = time();
                 //注册时间
                 $user->salt = rand(100000, 999999);
                 //随机生成salt值
                 $user->password = md5(md5('12345678') . $user->salt);
                 //默认密码12346
                 $user->token = $token;
                 //激活识别码
                 $user->token_exptime = $token_exptime;
                 //验证超时时间
                 if ($user->save() == true) {
                     $this->tag->setTitle('注册成功 | FiSkinAlcon');
                     $this->flash->success("注册成功!一封激活邮件已发往您的邮箱,请及时登录查看喵~");
                 } else {
                     $this->tag->setTitle('新用户注册 | FiSkinAlcon');
                     foreach ($user->getMessages() as $message) {
                         $errmsg .= getMessage() . "<br/>";
                     }
                     $this->flash->error($errmsg);
                 }
             }
             break;
     }
 }
예제 #27
0
파일: db.php 프로젝트: EliuFlorez/app-slim
function getConnection()
{
    $host = "ec2-54-83-204-159.compute-1.amazonaws.com";
    $username = "******";
    $password = "******";
    $database = "dd7hp9quurpihj";
    $conn = null;
    try {
        $conn = new PDO("pgsql:host={$host};dbname={$database}", $username, $password);
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    } catch (PDOException $e) {
        echo 'ERROR: ' . $e . getMessage();
    }
    return $conn;
}
 function getBuilding($building_id)
 {
     // based on id, fetch info about building
     $id = intval($building_id);
     $sql = "SELECT * \n                FROM up_buildings\n                WHERE building_id = :id";
     $stmt = $this->db_con->prepare($sql);
     $stmt->bindValue(':id', $id, PDO::PARAM_INT);
     try {
         $stmt->execute();
         // return $stmt->fetch(PDO::FETCH_ASSOC);
         // fetch as object
         return $stmt->fetchObject("Building");
     } catch (Exception $e) {
         echo "Query Error: " . $e . getMessage();
     }
 }
예제 #29
0
function addMessage($name, $relation, $content)
{
    $array = array("name" => $name, "relation" => $relation, "content" => $content, "time" => date("Y-m-d H:i:s", time()));
    $encodeJson = json_encode($array);
    $decodeJson = json_decode($encodeJson);
    giant_lock();
    $filedata = getMessage("message.json");
    $json = json_decode($filedata);
    if ($json == null) {
        $json = array();
    }
    array_push($json, $decodeJson);
    $fp = fopen("message.json", "w");
    fwrite($fp, json_encode($json));
    fclose($fp);
    giant_unlock();
}
예제 #30
0
 /**
  * Action to process and show the Joppa settings form
  * @return null
  */
 public function indexAction()
 {
     $zibo = Zibo::getInstance();
     $basePath = $this->request->getBasePath();
     $isPublished = $zibo->getConfigValue(NodeSettingModel::CONFIG_PUBLISH_DEFAULT, NodeSettingModel::DEFAULT_PUBLISH);
     $form = new SettingsForm($basePath, $isPublished);
     if ($form->isSubmitted()) {
         $isPublished = $form->isPublished();
         try {
             $zibo->setConfigValue(NodeSettingModel::CONFIG_PUBLISH_DEFAULT, $isPublished);
         } catch (Exception $e) {
             $zibo->runEvent(Zibo::EVENT_LOG, $e->getMessage(), $e->getTraceAsString());
             $this->addError(self::TRANSLATION_ERROR, array('error' => $e - getMessage()));
         }
     }
     $view = new SettingsView($form);
     $this->response->setView($view);
 }