Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from YetiForceCompany/developer
Browse files Browse the repository at this point in the history
from original git
  • Loading branch information
iRainSystem authored Jul 12, 2016
2 parents 3a1d727 + 163c3ca commit 012553b
Show file tree
Hide file tree
Showing 585 changed files with 8,249 additions and 5,653 deletions.
35 changes: 35 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
language: php

php:
- 5.5
- 5.6
- 7.0
- hhvm

matrix:
fast_finish: true
allow_failures:
- php: hhvm

services:
- mysql

mysql:
database: yetiforce
username: root
encoding: utf8

before_script:
- mysql -e "create database IF NOT EXISTS yetiforce;" -uroot
- cp tests/travis_config.php config/config_override.php
- cp tests/travis_debug.php config/debug.php
- cp tests/.htaccess .htaccess
- php tests/travis_install.php
- wget https://tests.yetiforce.com/Test.zip

script:
- php tests/travis_test.php

branches:
only:
- developer
6 changes: 3 additions & 3 deletions admin/include/WebUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function process (Vtiger_Request $request) {
vglobal('log', LoggerManager::getLogger('System'));
Vtiger_Session::init();
$forceSSL = vglobal('forceSSL');
if ($forceSSL && !Vtiger_Functions::getBrowserInfo()->https) {
if ($forceSSL && !vtlib\Functions::getBrowserInfo()->https) {
header("Location: https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
}

Expand Down Expand Up @@ -211,12 +211,12 @@ function process (Vtiger_Request $request) {
if ($view) {
// Log for developement.
error_log($e->getTraceAsString(), E_NOTICE);
Vtiger_Functions::throwNewException($e->getMessage());
vtlib\Functions::throwNewException($e->getMessage());
} else {
$response = new Vtiger_Response();
$response->setEmitType(Vtiger_Response::$EMIT_JSON);
$response->setError($e->getMessage());
//Vtiger_Functions::throwNewException($e->getMessage());
//vtlib\Functions::throwNewException($e->getMessage());
}
}

Expand Down
20 changes: 12 additions & 8 deletions api/dav.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$apiLog = new APINoPermittedException();
$apiLog->stop('Dav - Service is not active');
}
AppConfig::iniSet('error_log', $root_directory . 'cache/logs/davPhpError.log');
AppConfig::iniSet('error_log', ROOT_DIRECTORY . '/cache/logs/davPhpError.log');

/* Database */
$pdo = new PDO('mysql:host=' . $dbconfig['db_server'] . ';dbname=' . $dbconfig['db_name'] . ';charset=utf8', $dbconfig['db_username'], $dbconfig['db_password']);
Expand All @@ -19,9 +19,10 @@ function exception_error_handler($errno, $errstr, $errfile, $errline)
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler('exception_error_handler');
$enableWebDAV = false;

// Autoloader
require_once('libraries/SabreDAV/autoload.php');
require('libraries/SabreDAV/autoload.php');

// Backends
$authBackend = new Yeti\DAV_Auth_Backend_PDO($pdo);
Expand All @@ -38,14 +39,13 @@ function exception_error_handler($errno, $errstr, $errfile, $errline)
$carddavBackend = new Yeti\CardDAV_Backend_PDO($pdo);
$nodes[] = new Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend);
}
if (false && $enableWebDAV) {
if ($enableWebDAV) {
$exData = new stdClass();
$exData->pdo = $pdo;
$exData->storageDir = $davStorageDir;
$exData->historyDir = $davHistoryDir;
$exData->rootDirectory = $root_directory;
$exData->localStorageDir = $exData->rootDirectory . $exData->storageDir;
$exData->localHistoryDir = $exData->rootDirectory . $exData->historyDir;
$exData->localStorageDir = ROOT_DIRECTORY . $exData->storageDir;
$exData->localHistoryDir = ROOT_DIRECTORY . $exData->historyDir;
$directory = new Yeti\WebDAV_Directory('files', $exData);
$directory->getRootChild();
$nodes[] = $directory;
Expand All @@ -57,8 +57,6 @@ function exception_error_handler($errno, $errstr, $errfile, $errline)

// Plugins
$server->addPlugin(new Sabre\DAV\Auth\Plugin($authBackend));
$server->addPlugin(new Sabre\DAVACL\Plugin());
$server->addPlugin(new Sabre\DAV\Sync\Plugin());

if ($enableBrowser) {
$server->addPlugin(new Sabre\DAV\Browser\Plugin());
Expand All @@ -70,7 +68,13 @@ function exception_error_handler($errno, $errstr, $errfile, $errline)
$server->addPlugin(new Sabre\CalDAV\Plugin());
//$server->addPlugin(new Sabre\CalDAV\Subscriptions\Plugin());
//$server->addPlugin(new Sabre\CalDAV\Schedule\Plugin());
//$server->addPlugin(new Yeti\CalDAV_Schedule());
}
if ($enableWebDAV) {//WebDAV integration
$server->addPlugin(new Sabre\DAVACL\Plugin());
$server->addPlugin(new Sabre\DAV\Sync\Plugin());
}

if (AppConfig::debug('DAV_DEBUG_PLUGIN')) {
$server->addPlugin(new Yeti\Debug());
}
Expand Down
2 changes: 1 addition & 1 deletion api/mobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
require_once('include/database/PearDatabase.php');
require_once 'libraries/restler/restler.php';
require_once('include/utils/VtlibUtils.php');
AppConfig::iniSet('error_log', $root_directory . 'cache/logs/mobileApps.log');
AppConfig::iniSet('error_log', ROOT_DIRECTORY . '/cache/logs/mobileApps.log');

if (!in_array('mobile', $enabledServices)) {
require_once('include/exceptions/AppException.php');
Expand Down
2 changes: 1 addition & 1 deletion api/webservice.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$apiLog = new APINoPermittedException();
$apiLog->stop(['status' => 0, 'Encrypted' => 0, 'error' => ['message' => 'Webservice - Service is not active']]);
}
AppConfig::iniSet('error_log', $root_directory . 'cache/logs/webservice.log');
AppConfig::iniSet('error_log', ROOT_DIRECTORY . '/cache/logs/webservice.log');

define('REQUEST_MODE', 'API');

Expand Down
14 changes: 7 additions & 7 deletions api/webservice/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ public function process()
$data['record'] = $this->request->get('record');
}

if(!($this->request->get('action') == 'Login' && $this->request->get('module') == 'Users')){
if (!($this->request->get('action') == 'Login' && $this->request->get('module') == 'Users')) {
$session = APISession::checkSession($this->headers['Sessionid']);
if($session == false){

if ($session == false) {
throw new APIException('Invalid Sessionid', 401);
}
if(!$handler->checkPermission($this->request->get('action'), $session->get('user_id'))){
if (!$handler->checkPermission($this->request->get('action'), $session->get('user_id'))) {
throw new APIException('No permission to action', 405);
}
}

if (is_array($data)) {
$return = call_user_func_array([$handler, $function], $data);
} else {
Expand All @@ -114,14 +114,14 @@ public function postProcess()

public function encryptData($data)
{
$publicKey = 'file://' . vglobal('root_directory') . vglobal('publicKey');
$publicKey = 'file://' . ROOT_DIRECTORY . DIRECTORY_SEPARATOR . vglobal('publicKey');
openssl_public_encrypt(json_encode($data), $encrypted, $publicKey);
return $encrypted;
}

public function decryptData($data)
{
$privateKey = 'file://' . vglobal('root_directory') . vglobal('privateKey');
$privateKey = 'file://' . ROOT_DIRECTORY . DIRECTORY_SEPARATOR . vglobal('privateKey');
if (!$privateKey = openssl_pkey_get_private($privateKey)) {
throw new AppException('Private Key failed');
}
Expand Down
2 changes: 1 addition & 1 deletion api/webservice/APIException.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct($message, $code = 200, Exception $previous = null)
]
];
if (AppConfig::debug('DISPLAY_DEBUG_BACKTRACE')) {
$body['error']['backtrace'] = Vtiger_Functions::getBacktrace();
$body['error']['backtrace'] = vtlib\Functions::getBacktrace();
}

$response = APIResponse::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion api/webservice/Core/Auth/Digest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function requireLogin()

function getDigestHash($realm, $username)
{
$stmt = $this->pdo->prepare('SELECT digesta1 FROM ' . $this->tableName . ' WHERE username = ?');
$stmt = $this->pdo->prepare(sprintf('SELECT digesta1 FROM %s WHERE username = ?', $this->tableName));
$stmt->execute([$username]);
return $stmt->fetchColumn() ? : null;
}
Expand Down
2 changes: 1 addition & 1 deletion api/webservice/POS/modules/Products/GetProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class API_Products_GetProducts extends BaseAction

private function getTemplate()
{
$moduleId = Vtiger_Functions::getModuleId($this->moduleName);
$moduleId = vtlib\Functions::getModuleId($this->moduleName);
$db = PearDatabase::getInstance();
$query = 'SELECT templateid FROM vtiger_trees_templates WHERE module = ?';
return $db->getSingleValue($db->pquery($query, [$moduleId]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function post($orders)
$recordModel->set('assigned_user_id', $this->user['user_id']);
$recordModel->set('mode', '');
$countInventoryData = 0;
$defaultCurrency = Vtiger_Functions::getDefaultCurrencyInfo()['id'];
$defaultCurrency = vtlib\Functions::getDefaultCurrencyInfo()['id'];
$inventory = Vtiger_InventoryField_Model::getInstance($moduleName);
$fields = $inventory->getColumns();
$inventoryData = new Vtiger_Base_Model();
Expand Down
2 changes: 1 addition & 1 deletion api/webservice/POS/modules/TreesManager/GetTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class API_TreesManager_GetTree extends BaseAction

private function getTemplateId($moduleName)
{
$moduleId = Vtiger_Functions::getModuleId($moduleName);
$moduleId = vtlib\Functions::getModuleId($moduleName);
$db = PearDatabase::getInstance();
$query = 'SELECT templateid FROM vtiger_trees_templates WHERE module = ?';
return $db->getSingleValue($db->pquery($query, [$moduleId]));
Expand Down
Loading

0 comments on commit 012553b

Please sign in to comment.