Esempio n. 1
0
function create_thumb($name, $th_name, $th_height)
{
    global $config;
    global $strPermissionInvalide, $strExtensionNonSupporte;
    $im = '';
    $result = 0;
    if (extension_loaded('gd')) {
        $data = @GetImageSize($name, $info);
        if ($data == NULL) {
            show_warning("{$strPermissionInvalide} : {$name}");
        } else {
            switch ($data[2]) {
                case 1:
                    $imgtype = 'GIF';
                    $im = @imagecreatefromgif($name);
                    break;
                    // GIF
                // GIF
                case 2:
                    $imgtype = 'JPEG';
                    $im = @imagecreatefromjpeg($name);
                    break;
                    // JPG
                // JPG
                case 3:
                    $imgtype = 'PNG';
                    $im = @imagecreatefrompng($name);
                    break;
                    // PNG
            }
            if ($im == '') {
                show_warning("{$strExtensionNonSupporte} : {$imgtype}");
            } else {
                $w = ImageSX($im);
                $h = ImageSY($im);
                $nw = round($w * $th_height / $h);
                $nh = $th_height;
                if (function_exists("ImageCreateTrueColor")) {
                    // GD 2.0 or up
                    $ni = ImageCreateTrueColor($nw, $nh);
                    ImageCopyResampled($ni, $im, 0, 0, 0, 0, $nw, $nh, $w, $h);
                } else {
                    // GD version < 2
                    $ni = ImageCreate($nw, $nh);
                    ImageCopyResized($ni, $im, 0, 0, 0, 0, $nw, $nh, $w, $h);
                }
                ImageDestroy($im);
                switch ($imgtype) {
                    //case  'GIF': @ImageGif($ni,$th_name);break;
                    case 'JPG':
                        @ImageJpeg($ni, $th_name);
                        break;
                    case 'PNG':
                        @ImagePng($ni, $th_name);
                        break;
                    default:
                        @ImageJpeg($ni, $th_name);
                        break;
                }
                ImageDestroy($ni);
                $result = 'OK';
            }
        }
    }
    return $result;
}
Esempio n. 2
0
                }
            }
            $tsCf = $salary->timesheetCreateForm();
            if ($tsCf) {
                $timesheetsControls = wf_modal(web_add_icon() . ' ' . __('Create'), __('Create') . ' ' . __('Timesheet'), $tsCf, 'ubButton', '800', '600');
                show_window('', $timesheetsControls);
                if (!wf_CheckGet(array('showdate'))) {
                    //render available timesheets list by date
                    show_window(__('Timesheets'), $salary->timesheetsListRender('?module=salary_timesheets'));
                } else {
                    //saving changes for single timesheet row
                    if (wf_CheckPost(array('edittimesheetid'))) {
                        $salary->timesheetSaveChanges();
                        rcms_redirect('?module=salary_timesheets&showdate=' . $_GET['showdate']);
                    }
                    //render timesheet by date (edit form)
                    show_window(__('Timesheet') . ' ' . $_GET['showdate'], $salary->timesheetEditForm($_GET['showdate']));
                    show_window('', wf_Link('?module=salary_timesheets', __('Back'), false, 'ubButton'));
                }
            } else {
                show_warning(__('No available workers for timesheets'));
            }
        } else {
            show_error(__('No license key available'));
        }
    } else {
        show_error(__('This module is disabled'));
    }
} else {
    show_error(__('Permission denied'));
}
Esempio n. 3
0
     } else {
         show_window(__('Error'), __('Access denied'));
     }
 }
 //switch deletion
 if (isset($_GET['switchdelete'])) {
     if (!empty($_GET['switchdelete'])) {
         if (cfr('SWITCHESEDIT')) {
             if (ub_SwitchIsParent($_GET['switchdelete'])) {
                 if (wf_CheckGet(array('forcedel'))) {
                     //forced parent switch deletion, childs flush
                     ub_SwitchFlushChilds($_GET['switchdelete']);
                     ub_SwitchDelete($_GET['switchdelete']);
                     rcms_redirect("?module=switches");
                 } else {
                     show_warning(__('This switch is the parent for other switches'));
                 }
             } else {
                 ub_SwitchDelete($_GET['switchdelete']);
                 rcms_redirect("?module=switches");
             }
         } else {
             show_window(__('Error'), __('Access denied'));
         }
     }
 }
 if (!isset($_GET['edit'])) {
     $swlinks = '';
     if (cfr('SWITCHESEDIT')) {
         $swlinks .= wf_modalAuto(wf_img('skins/add_icon.png') . ' ' . __('Add switch'), __('Add switch'), web_SwitchFormAdd(), 'ubButton');
     }
Esempio n. 4
0
         $swLogin->SwLoginEditConnForm($_GET['edit']);
     }
 }
 if (!isset($_GET['edit'])) {
     $megaForm = wf_AjaxLoader();
     $megaForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&ajax=snmp', 'SNMP', 'megaContainer1', false, 'ubButton');
     $megaForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&ajax=connect', 'Connect', 'megaContainer1', false, 'ubButton');
     $megaForm .= wf_tag('div', false, '', 'id="megaContainer1"') . wf_tag('div', true);
     show_window(__("Switches login data"), $megaForm);
     $swLogin->ShowSwAllLogin();
 } else {
     $megaEditForm = wf_AjaxLoader();
     $megaEditForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&edit=' . $_GET['edit'] . '&ajax=snmp_edit', 'SNMP', 'megaContainer1', false, 'ubButton');
     $megaEditForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&edit=' . $_GET['edit'] . '&ajax=connect_edit', 'Connect', 'megaContainer1', false, 'ubButton');
     $megaEditForm .= wf_tag('div', false, '', 'id="megaContainer1"') . wf_tag('div', true);
     show_warning(__("Are you sure that you want to change switch login data") . "?");
     show_window(__("Switches login data"), $megaEditForm);
     $back = wf_Link(SwitchLogin::MODULE_URL, __('Back'), false, 'ubButton');
     show_window('', $back);
 }
 if (isset($_POST['add'])) {
     $params = array('swmodel', 'SwMethod');
     if (wf_CheckPost($params)) {
         $model = $_POST['swmodel'];
         $snmpTemplate = $_POST['snmptemplate'];
         $login = $_POST['SwLogin'];
         $pass = $_POST['SwPass'];
         $method = $_POST['SwMethod'];
         $community = $_POST['RwCommunity'];
         $enable = $_POST['Enable'];
         $swLogin->SwLoginAdd($model, $login, $pass, $method, $community, $enable, $snmpTemplate);
Esempio n. 5
0
        } else {
            fclose($fd);
        }
        echo "<h3>{$strInstallStage3}</h3>";
        echo "{$strInstallStage3Consignes}<br>";
        echo "Support ? : http://forum.phptournois.net/ !<br>";
        echo "Don't forgot to go on your configuration pag for define new configuration tool !<br>";
        echo "N'oubliez pas d'aller sur votre page configuration pour définir les nouvelles options de configurations !<br>";
        /** tentative d'effacage **/
        @unlink('install.php');
        if (is_file('install.php')) {
            show_warning("{$strInstallStage3DelInstall}<br>");
        }
        @unlink('update.php');
        if (is_file('update.php')) {
            show_warning("{$strInstallStage3Delupdatel}<br>");
        }
        if (!file_exists("g4.g4")) {
            try {
                fwrite(fopen("g4.g4", "w"), "phpTG4 installed");
            } catch (Eception $e) {
                echo "can't create g4.g4 files on root to prevent install exploit";
            }
        }
    }
} elseif ($stage == 4) {
    echo "<h3>{$strInstallStage3}</h3>";
    echo "{$strInstallStage3Consignes}<br>";
}
echo "<br>";
include 'include/footer.inc.php';
Esempio n. 6
0
                                            // def pts
                                            $s_j = show_joueur($s_joueur, "", "", "", "left", "player_lad_name");
                                            if ($lad_mod->def_pts != NULL || $lad_mod->def_pts != 0 || $lad_mod->def_pts != '0') {
                                                $define_pts = $lad_mod->def_pts;
                                            } else {
                                                $define_pts = 0;
                                            }
                                            $db->insert("{$dbprefix}lad_part (ladder_id,name,pts,joueur_id)");
                                            $db->values("'{$lad_id}','{$s_j}','{$define_pts}','{$s_joueur}'");
                                            $db->exec();
                                            /*** redirection ***/
                                            js_goto("?page=ladder&lad_id={$lad_id}&op=player_lad");
                                        } else {
                                            if ($lad_mod->ladder_type == '2' and empty($step2)) {
                                                if ($grade['x'] != 'x') {
                                                    show_warning($strLAD_yournotmanager);
                                                } else {
                                                    $db->select("nom");
                                                    $db->from("{$dbprefix}equipes WHERE manager='{$s_joueur}'");
                                                    $res = $db->exec();
                                                    echo '<br>' . $strLAD_whosteam . '<br>
				<form method="post" action="?page=ladder&op=join_lad&step2=oui&lad_id=' . $lad_id . '">
				<select name="team">';
                                                    while ($lad_mod = $db->fetch($res)) {
                                                        echo '
						<option value="' . $lad_mod->nom . '">' . $lad_mod->nom . '</option>
					';
                                                    }
                                                    echo '</select><input type="submit" value="' . $strValider . '">
				</form>';
                                                }
Esempio n. 7
0
        // tag deletion
        if (isset($_GET['deletetag'])) {
            //reset user if needed
            if ($alter_conf['RESETONTAGCHANGE']) {
                $billing->resetuser($uname);
                log_register("RESET User (" . $uname . ")");
            }
            if (!$alter_conf['CEMETERY_ENABLED']) {
                //normal tag deletion
                stg_del_user_tag($_GET['deletetag']);
                rcms_redirect("?module=usertags&username="******"?module=usertags&username=" . $uname);
                } else {
                    show_warning(__('This tag type is protected by cemetery'));
                }
            }
        }
        show_window(__('Tags'), stg_show_user_tags($uname));
        stg_tagadd_selector();
        stg_tagdel_selector($uname);
        show_window('', web_UserControls($uname));
    }
} else {
    show_error(__('Access denied'));
}
Esempio n. 8
0
 /**
  * Performs import of uploaded KML file
  * 
  * @param string $filename
  */
 protected function itemsImportKml($filename, $mapId, $type)
 {
     $mapId = vf($mapId, 3);
     $type = vf($type);
     $toImport = array();
     $importCount = 0;
     if (file_exists(self::UPLOAD_PATH . '/' . $filename)) {
         $rawData = file_get_contents(self::UPLOAD_PATH . '/' . $filename);
         if (!empty($rawData)) {
             $rawData = zb_xml2array($rawData);
             if (isset($this->allMaps[$mapId])) {
                 if (!empty($rawData)) {
                     if (isset($rawData['kml'])) {
                         if (isset($rawData['kml']['Document'])) {
                             $importDocument = $rawData['kml']['Document'];
                             if (!empty($importDocument)) {
                                 //turbo GPS 3 broken format
                                 foreach ($importDocument as $io => $each) {
                                     if ($io == 'Placemark') {
                                         $toImport = $each;
                                     } else {
                                         //natural google earth format
                                         if (is_array($each)) {
                                             foreach ($each as $ia => $deeper) {
                                                 if ($ia == 'Placemark') {
                                                     $toImport = $deeper;
                                                 }
                                             }
                                         }
                                     }
                                     //extracting placemarks
                                     if (!empty($toImport)) {
                                         $placemarks = $this->kmlExtractPlacemarks($toImport);
                                         if (!empty($placemarks)) {
                                             foreach ($placemarks as $ix => $importPm) {
                                                 $this->itemCreate($mapId, $type, $importPm['geo'], $importPm['name'], '');
                                                 $importCount++;
                                             }
                                             show_info(__('Objects') . ': ' . $importCount);
                                             show_window('', wf_Link('?module=custmaps&showitems=' . $mapId, wf_img('skins/refresh.gif') . ' ' . __('Renew'), false, 'ubButton'));
                                         }
                                     }
                                 }
                             }
                         } else {
                             show_error(self::EX_WRONG_KML);
                         }
                     } else {
                         show_error(self::EX_WRONG_KML);
                     }
                 } else {
                     show_warning(__('Empty file') . ' ' . self::EX_WRONG_KML);
                 }
             } else {
                 show_error(self::EX_NO_MAP_ID);
             }
         } else {
             show_warning(__('Empty file') . ' (.kml)');
         }
     } else {
         show_error(self::EX_NO_FILE);
     }
 }
Esempio n. 9
0
                    $count++;
                    $fees = $funds->getFees($eachlogin);
                    $payments = $funds->getPayments($eachlogin);
                    $paymentscorr = $funds->getPaymentsCorr($eachlogin);
                    $fundsflow = $fees + $payments + $paymentscorr;
                    $dateFunds = $funds->filterByDate($fundsflow, $date);
                    if (!$agentFilter) {
                        $rows .= $funds->renderCorpsFlows($count, $dateFunds, $corpsData, $corpUsers, $allUserContracts, $allUsersCash, $allUserTariffs, $allTariffPrices);
                    } else {
                        @($userAddress = $alladdress[$eachlogin]);
                        $assigned_agent = zb_AgentAssignCheckLoginFast($eachlogin, $allassigns, $userAddress, $allassignsStrict);
                        if ($assigned_agent == $agentFilter) {
                            $rows .= $funds->renderCorpsFlows($count, $dateFunds, $corpsData, $corpUsers, $allUserContracts, $allUsersCash, $allUserTariffs, $allTariffPrices);
                        }
                    }
                }
                $rows .= $funds->renderCorpsFlowsTotal();
                $report = wf_TableBody($rows, '100%', 0, '');
                show_window(__('Report'), $report);
            } else {
                show_warning(__('Nothing found'));
            }
        } else {
            show_error(__('No license key available'));
        }
    } else {
        show_error(__('This module is disabled'));
    }
} else {
    show_error(__('Access denied'));
}
Esempio n. 10
0
 /**
  * Change pvid on users port
  * 
  * @param string $login
  * @param integer $vlan
  * @return void
  */
 public function ChangePvid($login, $vlan)
 {
     if ($this->GetSwitchPortData($login)) {
         $SwitchPortData = $this->GetSwitchPortData($login);
         $port = $SwitchPortData['port'];
         $SwitchId = $SwitchPortData['switchid'];
         $ModelId = $this->AllSwitches[$SwitchId]['modelid'];
         if ($this->GetSwitchLoginData($SwitchId)) {
             $SwitchLoginData = $this->GetSwitchLoginData($SwitchId);
             $method = $SwitchLoginData['method'];
             if ($method == 'SNMP') {
                 $community = $SwitchLoginData['community'];
                 $snmpTemplate = $SwitchLoginData['snmptemplate'];
                 if ($this->GetSwitchesData($SwitchId)) {
                     $SwitchesData = $this->GetSwitchesData($SwitchId);
                     $ip = $SwitchesData['ip'];
                     $ParentId = $SwitchesData['parentid'];
                     if (file_exists(self::AUTOCONFIG . $snmpTemplate)) {
                         $SNMPData = rcms_parse_ini_file(self::AUTOCONFIG . $snmpTemplate, true);
                         if (isset($SNMPData['define']['HEX'])) {
                             $group = 0;
                             if ($port > 4) {
                                 $portPlace = $port % 4;
                                 if ($portPlace == 0) {
                                     $portPlace = 4;
                                 }
                                 $counter = $port;
                                 while ($counter > 0) {
                                     $group++;
                                     $counter -= 4;
                                 }
                             } else {
                                 $group = 1;
                                 $portPlace = $port;
                             }
                             switch ($portPlace) {
                                 case 1:
                                     $portPlaceHex = 8;
                                     break;
                                 case 2:
                                     $portPlaceHex = 4;
                                     break;
                                 case 3:
                                     $portPlaceHex = 2;
                                     break;
                                 case 4:
                                     $portPlaceHex = 1;
                                     break;
                             }
                             $hexString = $SNMPData['define']['HEX'];
                             $hexString = str_replace(' ', '', $hexString);
                             $hexString[$group - 1] = $portPlaceHex;
                             $split = str_split($hexString);
                             $hexString = '';
                             $stringCounter = 1;
                             foreach ($split as $each) {
                                 if ($stringCounter % 2 == 0) {
                                     $hexString .= $each . " ";
                                 } else {
                                     $hexString .= $each;
                                 }
                                 $stringCounter++;
                             }
                             $pattern = array('/PORT/', '/VLAN/', '/HEX/');
                             $replace = array($port, $vlan, $hexString);
                         } else {
                             $pattern = array('/PORT/', '/VLAN/');
                             $replace = array($port, $vlan);
                         }
                         if ($SNMPData['define']['TYPE'] == 'simple') {
                             foreach ($SNMPData as $section => $eachpoll) {
                                 if ($section != 'define') {
                                     if ($this->CheckVlan($ip, $community, $SNMPData['define']['CHECK'] . "." . $vlan)) {
                                         if ($section != 'create') {
                                             $data[] = array('oid' => preg_replace($pattern, $replace, $eachpoll['OID']), 'type' => $eachpoll['TYPE'], 'value' => preg_replace($pattern, $replace, $eachpoll['VALUE']));
                                         }
                                     } else {
                                         $data[] = array('oid' => preg_replace($pattern, $replace, $eachpoll['OID']), 'type' => $eachpoll['TYPE'], 'value' => preg_replace($pattern, $replace, $eachpoll['VALUE']));
                                     }
                                 }
                             }
                             $result = $this->SnmpHelper->set($ip, $community, $data);
                             if (isset($result)) {
                                 $CheckOid = preg_replace($pattern, $replace, $SNMPData['change']['OID']);
                                 if ($this->CheckPvid($ip, $community, $CheckOid, $vlan)) {
                                     if (!empty($ParentId)) {
                                         $this->CreateVlanLooped($ParentId, $vlan);
                                     } else {
                                         show_warning(__("Switch has no uplink"));
                                     }
                                     log_register(__("Change PVID to") . " " . $vlan . " vlan " . __("on port") . " " . $port . " " . __("switch") . " " . $ip . " " . __("for") . " " . $login);
                                     show_success($result);
                                 } else {
                                     show_error(__("Something goes wrong, vlan wasnt applied on port"));
                                 }
                             } else {
                                 show_error(__('Nothing happend'));
                             }
                         }
                         if ($SNMPData['define']['TYPE'] == 'alcatel') {
                             $data = '';
                             foreach ($SNMPData as $section => $eachpoll) {
                                 if ($section != 'define') {
                                     if ($this->CheckVlan($ip, $community, $SNMPData['define']['CHECK'] . "." . $vlan)) {
                                         if ($section != 'create') {
                                             $oid = preg_replace($pattern, $replace, $eachpoll['OID']);
                                             $type = $eachpoll['TYPE'];
                                             $value = preg_replace($pattern, $replace, $eachpoll['VALUE']);
                                             $data .= $oid . ' ' . $type . ' ' . $value . ' ';
                                         }
                                     } else {
                                         $oid = preg_replace($pattern, $replace, $eachpoll['OID']);
                                         $type = $eachpoll['TYPE'];
                                         $value = preg_replace($pattern, $replace, $eachpoll['VALUE']);
                                         $data .= $oid . ' ' . $type . ' ' . $value . ' ';
                                     }
                                 }
                             }
                             $this->loadAlter();
                             if ($this->AltCfg['SNMP_MODE'] != 'system') {
                                 $snmpSet = $this->AltCfg['SNMPSET_PATH'];
                                 $snmpSet .= ' -c ' . $community . ' ' . $ip . ' ' . $data;
                                 $result = shell_exec($snmpSet);
                             } else {
                                 $result = $this->SnmpHelper->set($ip, $community, $data);
                             }
                             if (isset($result)) {
                                 $CheckOid = preg_replace($pattern, $replace, $SNMPData['change']['OID']);
                                 if ($this->CheckPvid($ip, $community, $CheckOid, $vlan)) {
                                     if (!empty($ParentId)) {
                                         $this->CreateVlanLooped($ParentId, $vlan);
                                     } else {
                                         show_warning(__("Switch has no uplink"));
                                     }
                                     log_register(__("Change PVID to") . " " . $vlan . " vlan " . __("on port") . " " . $port . " " . __("switch") . " " . $ip . " " . __("for") . " " . $login);
                                     show_success($result);
                                 } else {
                                     show_error(__("Something goes wrong, vlan wasnt applied on port"));
                                 }
                             } else {
                                 show_error(__('Nothing happend'));
                             }
                         }
                     } else {
                         show_error(__("No suitable SNMP template found"));
                     }
                 } else {
                     show_error(__('Swich has no ip or parent for switchid' . ' ' . $SwitchId));
                 }
             } else {
                 $swlogin = $SwitchLoginData['swlogin'];
                 $swpass = $SwitchLoginData['swpass'];
                 if ($this->GetSwitchesData($SwitchId)) {
                     $SwitchesData = $this->GetSwitchesData($SwitchId);
                     $ip = $SwitchesData['ip'];
                     $this->LoadAllSwitchModels();
                     $swmodel = $this->AllSwitchModels[$ModelId];
                     shell_exec(CONFIG_PATH . "scripts/{$swmodel} {$swlogin} {$swpass} {$ip} {$vlan} {$port}");
                     show_success(__("Success"));
                 }
             }
         } else {
             show_error(__('No switch login data found for switchid' . ' ' . $SwitchId));
         }
     } else {
         show_error(__('No switchport data found'));
     }
 }
Esempio n. 11
0
            }
        }
        $result = array("aaData" => $jsonAAData);
        return json_encode($result);
    }
    // Ajax data source display
    if (isset($_GET['ajax'])) {
        if ($hp_mode) {
            //default rendering
            if ($hp_mode == 1) {
                die(zb_AjaxOnlineDataSourceSafe());
            }
            //fast with caching, for huge databases.
            if ($hp_mode == 2) {
                $defaultJsonCacheTime = 600;
                $onlineJsonCache = new UbillingCache();
                $fastJsonReply = $onlineJsonCache->getCallback('HPONLINEJSON', function () {
                    return zb_AjaxOnlineDataSourceFast();
                }, $defaultJsonCacheTime);
                die($fastJsonReply);
            }
        }
    }
    if (!$hp_mode) {
        show_warning(__('ONLINE_HP_MODE=0 no more supported. Use 1 - safe or 2 - fast for large databases modes.'));
    } else {
        show_window(__('Users online'), renderUserListContainer());
    }
} else {
    show_error(__('Access denied'));
}
Esempio n. 12
0
        $directory = "/";
    }
    if ($upload == 1) {
        include_once "include/class.upload.php";
        $uploadc = new Upload();
        $uploadc->maxupload_size = $config['download_max_filesize'];
        $destination = $config['download_path'] . "/{$match}/{$directory}";
        $field_filename = trim($uploadc->getFileName("userfile"));
        if ($field_filename) {
            if ($uploadc->save($destination, "userfile", true)) {
                js_goto("?page=matchs_browser&match={$match}&directory={$directory}&header=win");
            } else {
                show_warning($uploadc->errors);
            }
        } else {
            show_warning("{$strFichierInvalide} : {$field_filename}");
        }
    }
}
/********************************************************
 * Effacement d'un fichier
 */
if ($op == 'delete') {
    /*** verification securite ***/
    if ($grade['a'] != 'a' && $grade['b'] != 'b' && $grade['t'] != 't' && $grade['u'] != 'u') {
        js_goto($PHP_SELF);
    }
    $filename = str_replace("/", "", $filename);
    if (!is_dir($config['download_path'] . "/{$match}/{$directory}") || $directory == "") {
        $directory = "/";
    }
Esempio n. 13
0
 /**
  * Returns standard user list of users assigned for some corp
  * 
  * @param string $corpname
  * @return string
  */
 public function searchUsersByCorpName($corpname)
 {
     $result = '';
     if (!empty($corpname)) {
         $corpId = $this->searchCorpIdbyName($corpname);
         if (!empty($corpId)) {
             $corpLink = wf_Link('?module=corps&show=corps&editid=' . $corpId, $this->corps[$corpId]['corpname'], false, '');
             show_success($corpLink);
             $corpUsers = $this->searchUsersByCorpId($corpId);
             if (!empty($corpUsers)) {
                 $result = web_UserArrayShower($corpUsers);
             } else {
                 show_warning(__('Nothing found'));
             }
         } else {
             show_warning(__('Nothing found'));
         }
     }
     return $result;
 }