function supportHoursIncludedInContract($id_client)
 {
     CybPHP_Validate::ValidateInt($id_client);
     $query = "SELECT supportHoursIncludedInContract\nFROM webfinance.webfinance_clients\nWHERE id_client = {$id_client}";
     $result = mysql_query($query) or die(mysql_error());
     if (mysql_num_rows($result) != 1) {
         return 0;
     }
     $row = mysql_fetch_assoc($result);
     return $row['supportHoursIncludedInContract'];
 }
 function GetInfo()
 {
     CybPHP_Validate::ValidateInt($this->_company_id);
     $result = CybPHP_MySQL::Query('SELECT nom AS name ' . 'FROM webfinance_clients ' . "WHERE id_client = {$this->_company_id}");
     return mysql_fetch_assoc($result);
 }
示例#3
0
 /**
  * Add a new client.
  *
  * @param Int webfinance_client_id The Webfinance client id.
  *
  * @param String client_name The name of the client.
  *
  **/
 function createClient($webfinance_client_id = 0, $client_name = NULL)
 {
     CybPHP_Validate::ValidateInt($webfinance_client_id);
     $url = 'https://www.toggl.com/api/v8/clients';
     $options = array('client' => array('name' => $client_name, 'wid' => $this->_wid));
     $return = $this->query($url, $options);
     $id_toggl = $return['data']['id'];
     if (empty($id_toggl)) {
         echo "unable to fetch id_toggl";
         print_r($return);
         exit(1);
     }
     mysql_query('UPDATE webfinance_clients ' . "SET id_toggl = {$id_toggl} " . "WHERE id_client = {$webfinance_client_id}") or die(mysql_error());
     // Create projects
     foreach ($this->_default_projects as $project_name) {
         $this->createProject($id_toggl, $project_name);
     }
 }
示例#4
0
            continue;
        }
        upload_file($file, basename($file));
    }
}
require "../inc/main.php";
$User = new User();
if (!$User->isAuthorized("manager,accounting,employee")) {
    $_SESSION['came_from'] = $_SERVER['REQUEST_URI'];
    header("Location: /login.php");
    exit;
}
if (!isset($_FILES['file']['name'])) {
    die('Too few argument. PHP upload limit reached?');
}
CybPHP_Validate::ValidateInt($_SESSION['id_user']);
if ($_FILES['file']['error'] !== 0) {
    die('Unknown upload error from PHP');
}
$file_extension = preg_replace('/.*\\./', '', $_FILES['file']['name']);
switch (strtolower($file_extension)) {
    case 'zip':
        upload_zip($_FILES['file']['tmp_name']);
        break;
    case 'pdf':
    case 'odt':
    case 'doc':
    case 'ods':
    case 'xls':
    case 'ppt':
        upload_file($_FILES['file']['tmp_name'], $_FILES['file']['name']);