示例#1
0
    public function adminPage($action = false)
    {
        if (!$action) {
            $action = $_REQUEST['action'];
        }
        if (!$table) {
            $table = $_REQUEST['table'];
        }
        // Only supports simple index fields.
        if (!is_array($this->_idField)) {
            if (!$id) {
                $id = $_REQUEST[$this->_idField];
            }
        } else {
            foreach ($this->_idField as $field) {
                $id[$field] = $_REQUEST[$field];
            }
        }
        $this->adminPageTop();
        switch ($action) {
            case "delete":
                $obj = DBOS::factory($this->_table, $id);
                $obj->delete();
                show_success("The record was delete from " . $this->_table);
                $this->showTable();
                break;
            case "summary":
            case $this->_table . "_summary":
                $obj = DBOS::factory($this->_table, $id);
                // Should be toAdminHTML.
                if (is_numeric($obj->id)) {
                    ?>
| <a class="editMe" href="<?php 
                    echo $_SERVER[PHP_SELF];
                    ?>
?action=edit&table=<?php 
                    echo $obj->_table;
                    ?>
&<?php 
                    echo $this->_idField;
                    ?>
=<?php 
                    echo $obj->id;
                    ?>
">Edit this <?php 
                    echo $obj->_table;
                    ?>
</a><?php 
                }
                $obj->toHTML();
                break;
            case "edit_" . $this->_table:
            case "edit":
                $obj = DBOS::factory($this->_table, $id);
                $obj->showForm();
                break;
            case "db_edit_" . $this->_table:
                $obj = DBOS::factory($this->_table, $id);
                $obj->saveForm();
                $this->showTable();
                break;
            case "list":
            case "":
                $this->showTable();
                break;
            default:
                ?>
The action <?php 
                echo $action;
                ?>
 is not defined for this the <?php 
                echo $this->_table;
                ?>
 class.  Use Object->adminPage to set.<?php 
        }
    }
示例#2
0
 /**
  * Performs job states processing
  * 
  * @return void
  */
 public function payrollStateProcessing()
 {
     $jobCount = 0;
     if (wf_CheckPost(array('_prstatecheck'))) {
         $checksRaw = $_POST['_prstatecheck'];
         if (!empty($checksRaw)) {
             foreach ($checksRaw as $io => $each) {
                 $jobId = vf($io, 3);
                 simple_update_field('salary_jobs', 'state', '1', " WHERE `id`='" . $jobId . "';");
                 $this->pushPaid($jobId);
                 $jobCount++;
             }
             show_success(__('Job payment processing finished'));
             log_register('SALARY JOBS PROCESSED `' . $jobCount . '`');
         } else {
             log_register('SALARY JOBS PROCESSING FAIL EMPTY_JOBIDS');
         }
     }
 }
function do_backup($downloadFiles)
{
    global $config, $verbose;
    if ($verbose) {
        echo "Warning: This script may run for a LONG time\n";
    }
    $currentdir = getcwd();
    $timeStamp = date('Y-m-d_H-i');
    $backupTo = $config['backupTo'];
    $path_base = $backupTo . '/' . $timeStamp;
    mkdir($path_base);
    $podioOrgs = PodioOrganization::get_all();
    foreach ($podioOrgs as $org) {
        //org_id
        if ($verbose) {
            echo "Org: " . $org->name . "\n";
        }
        $path_org = $path_base . '/' . fixDirName($org->name);
        mkdir($path_org);
        $contactsFile = '';
        try {
            $contacts = PodioFetchAll::iterateApiCall('PodioContact::get_for_org', $org->org_id);
            $contactsFile .= contacts2text($contacts);
        } catch (PodioError $e) {
            show_error($e);
            $contactsFile .= "\n\nPodio Error:\n" . $e;
        }
        file_put_contents($path_org . '/' . 'podio_organization_contacts.txt', $contactsFile);
        foreach ($org->spaces as $space) {
            // space_id
            if ($verbose) {
                echo "Space: " . $space->name . "\n";
            }
            $path_space = $path_org . '/' . fixDirName($space->name);
            mkdir($path_space);
            $contactsFile = '';
            try {
                if ($space->name == "Employee Network") {
                    $filter = array('contact_type' => 'user');
                } else {
                    $filter = array('contact_type' => 'space');
                }
                $contacts = PodioFetchAll::iterateApiCall('PodioContact::get_for_space', $space->space_id, $filter);
                $contactsFile .= contacts2text($contacts);
            } catch (PodioError $e) {
                show_error($e);
                $contactsFile .= "\n\nPodio Error:\n" . $e;
            }
            file_put_contents($path_space . '/' . 'podio_space_contacts.txt', $contactsFile);
            $spaceApps = array();
            try {
                $spaceApps = PodioApp::get_for_space($space->space_id);
                RateLimitChecker::preventTimeOut();
            } catch (PodioError $e) {
                show_error($e);
            }
            foreach ($spaceApps as $app) {
                backup_app($app, $path_space, $downloadFiles);
            }
        }
    }
    if ($verbose) {
        show_success("Backup Completed successfully to " . $currentdir . "/" . $backupTo . "/" . $timeStamp);
    }
}
示例#4
0
/**
 * Dumps database to file and returns filename
 * 
 * @param bool   $silent
 * @return string
 */
function zb_backup_database($silent = false)
{
    global $ubillingConfig;
    $alterConf = $ubillingConfig->getAlter();
    $mysqlConf = rcms_parse_ini_file(CONFIG_PATH . 'mysql.ini');
    $backname = DATA_PATH . 'backups/sql/ubilling-' . date("Y-m-d_H_i_s", time()) . '.sql';
    $command = $alterConf['MYSQLDUMP_PATH'] . ' -u ' . $mysqlConf['username'] . ' -p' . $mysqlConf['password'] . ' ' . $mysqlConf['db'] . ' > ' . $backname;
    shell_exec($command);
    if (!$silent) {
        show_success(__('Backup saved') . ': ' . $backname);
    }
    log_register("BACKUP CREATE `" . $backname . "`");
    return $backname;
}
示例#5
0
                rcms_redirect("?module=mikbill_migration&netnum=" . $_POST['netnum']);
            }
            if (isset($_GET['netnum'])) {
                show_window('networks', $mik->web_MikbillMigrationNetworksForm($_GET['netnum']));
                $converts = array('db_user', 'db_pass', 'db_host', 'db_name', 'tariff_period', 'network');
                if (isset($_POST['network'])) {
                    if (wf_CheckPost($converts)) {
                        $mik->ConvertMikBill($_POST['db_user'], $_POST['db_pass'], $_POST['db_host'], $_POST['db_name'], $_POST['network'], $_POST['tariff_period']);
                        rcms_redirect("?module=mikbill_migration&success=1");
                    } else {
                        rcms_redirect("?module=mikbill_migration&notall=1");
                    }
                }
            } else {
                show_window('Networks number', $mik->web_MikbillMigrationNetnumForm());
            }
            if (isset($_GET['notall'])) {
                show_error("No all of required fields is filled");
            }
            if (isset($_GET['success'])) {
                show_success("sql dump generated find it in ./content/backups/sql/ub_dump.sql");
            }
        } else {
            show_error('ub.sql not found');
        }
    } else {
        show_error(__('No license key available'));
    }
} else {
    show_error(__('Access denied'));
}
示例#6
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'));
     }
 }
示例#7
0
            } else {
                show_window(__('Current user Vlan'), wf_tag('h2', false, 'floatpanels', '') . ' ' . $cur_vlan . wf_tag('h2', true) . '<br clear="both" />');
                show_window('', $VlanGen->ChangeForm());
                show_window('', wf_JSAlert(VlanGen::MODULE_URL . "&username="******"&DeleteVlanHost=true", $VlanGen->DeleteForm(), __('Removing this may lead to irreparable results')));
                if ($altcfg['SWITCH_AUTOCONFIG']) {
                    show_window('', $VlanGen->ChangeOnPortForm());
                }
                if ($altcfg['ONUAUTO_CONFIG']) {
                    show_window('', $VlanGen->ChangeOnOnuForm());
                }
                if (isset($_POST['ChangeVlanOnPort'])) {
                    $obj = new AutoConfigurator();
                    $set = $obj->ChangePvid($login, $cur_vlan);
                    if (isset($set)) {
                        show_success($set);
                    }
                }
                if (isset($_POST['ChangeOnuPvid'])) {
                    $onuconfig = new OnuConfigurator();
                    $onu_cfg = $onuconfig->ChangeOnuPvid($login, $cur_vlan);
                    show_success($onu_cfg);
                }
            }
            show_window('', web_UserControls($login));
        }
    } else {
        show_error(__('You cant control this module'));
    }
} else {
    show_error(__('This module is disabled'));
}
示例#8
0
				<button class="btn btn-danger" type="submit">Kiểm tra</button>
			</form>
		</div>
		<br>
		<div class="col-md-12">
		<br>
			<?php 
if (isset($_GET['IMEI'])) {
    $imei = $_GET['IMEI'];
    $came = get_Camera_by_IMEI($imei);
    if ($came) {
        foreach ($came as $item) {
            $success[] = "<h4><span class='glyphicon glyphicon-ok'></span> Đây là sản phẩm của iCam8</h4><br> Số IMEI: <strong>" . $item->IMEI . "</strong> <br /> Tên sản phẩm: <strong>" . $item->Name . "</strong> <br> <span class='glyphicon glyphicon-calendar'></span> Hạn bảo hành: <strong>" . $item->Date_out . "</strong>";
        }
    } else {
        $error[] = "IMEI: <strong>" . $imei . "</strong> không phải là sản phẩm của iCam8!";
    }
}
if (isset($success)) {
    show_success($success);
}
if (isset($error)) {
    show_error($error);
}
?>
		</div>
		
	</div><!-- #content-full -->

<?php 
get_footer();
示例#9
0
function dbos_delete($table, $id, $db, $indexField = false)
{
    $dbo = new DBOS($table, $id, $db, $indexField);
    $dbo->delete();
    show_success("Deleted record {$id} from table {$table}");
}
示例#10
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;
 }