Beispiel #1
0
function create_DOM()
{
    $name = config\platform::name;
    $charset = config\platform::charset;
    //get init script location
    $init_script_location = 'client/init.js';
    //get init script
    $init_script = init();
    $dom = new DOMDocument('1.0', 'utf-8');
    $dom->loadHTML('
        <!DOCTYPE html>
        <html>
            <head>
                <title>' . $name . '</title>
                <meta charset="' . $charset . '">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
            </head>
            <body>
                ' . $init_script . '
            </body>
        </html>
    ');
    ob_start();
    echo add_external_libs();
    echo $dom->saveHTML($dom->getElementsByTagName('!DOCTYPE html')->item(0));
    ob_end_flush();
}
function process($form_data)
{
    $a = session_id();
    include "connect.php";
    $conn = init($_SESSION["permission_type"]);
    $query = "\n\t\t\t\tSELECT salesrecord.cost, salesrecord.sale_price, salesrecord.transport_price FROM `salesrecord` \n\t\t\t\tinner join contract on contract.id=salesrecord.contract_id\n\t\t\t\tinner join user on contract.user_id=user.id\n\t\t\t\tOrder by salesrecord.date\n\t\t\t";
    if (isset($form_data['choosenuser']) && $form_data['choosenuser'] != "") {
        $query = "\n\t\t\t\tSELECT salesrecord.cost, salesrecord.sale_price, salesrecord.transport_price FROM `salesrecord` \n\t\t\t\tinner join contract on contract.id=salesrecord.contract_id\n\t\t\t\tinner join user on contract.user_id=user.id\n\t\t\t\tWhere user.name = '" . $form_data['choosenuser'] . "'\n\t\t\t\tOrder by salesrecord.date\n\t\t\t\t";
    }
    $result = $conn->query($query);
    $rows = $result->fetch_all(MYSQLI_ASSOC);
    $stat = array();
    $i = 0;
    $sum = 0;
    foreach ($rows as $column) {
        $i += 1;
        if ($i == 100) {
            $stat[] = $sum / 100;
            $i = 0;
            $sum = 0;
        }
        $sum += floatval($column['sale_price']) / (floatval($column['cost']) + floatval($column['transport_price']));
        //echo (   $hh . "<br>"   );
    }
    $stat[] = $sum / $i;
    echo json_encode(array("stat" => $stat));
}
Beispiel #3
0
 public static function delete($key)
 {
     self:
     init();
     $ret = self::$pool->delete($key);
     return $ret;
 }
function process($form_data)
{
    include "Helper.php";
    // pretty_print_array($form_data);
    $a = session_id();
    include "connect.php";
    $conn = init($_SESSION["permission_type"]);
    $result = array();
    if (isset($form_data["transportoffer---relation"])) {
        $result = deleteTransportOffer($form_data, $conn);
    } else {
        if (isset($form_data["user---relation"])) {
            $result = deleteUser($form_data, $conn);
        } else {
            if (isset($form_data["contract---relation"])) {
                $result = deleteContract($form_data, $conn);
            } else {
                if (isset($form_data["market---relation"])) {
                    $result = deleteMarket($form_data, $conn);
                } else {
                    if (isset($form_data["transportoffer---relation"])) {
                        $result = deleteTransportOffer($form_data, $conn);
                    } else {
                        if (isset($form_data["immigrants---relation"])) {
                            $result = deleteImigrants($form_data, $conn);
                        } else {
                            if (isset($form_data["product---relation"])) {
                                $result = deleteProduct($form_data, $conn);
                            } else {
                                if (isset($form_data["transportcompany---relation"])) {
                                    $result = deleteTransportCompany($form_data, $conn);
                                } else {
                                    if (isset($form_data["flavour---relation"])) {
                                        $result = deleteTaste($form_data, $conn);
                                    } else {
                                        if (isset($form_data["storagetype---relation"])) {
                                            $result = deleteStoragetype($form_data, $conn);
                                        } else {
                                            if (isset($form_data["country---relation"])) {
                                                $result = deleteCountry($form_data, $conn);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if ($result["error"] == "") {
        $returnedData = $conn->query($result["data"]);
    }
    if ($conn->connect_errno) {
        $result["error"] = $conn->connect_error;
    }
    $result["data"] = "";
    echo json_encode($result);
}
Beispiel #5
0
function compare()
{
    init();
    //如果目标数据库不存在,先创建一个
    $sql = 'create database if not exists ' . TARGET_DB . ' default charset utf8 collate utf8_general_ci';
    mysql_query($sql, TARGET_LINK);
    //获取数据源的数据结构
    $source_database_struct = get_database_struct(SOURCE_LINK, SOURCE_DB);
    //获取目标的数据结构
    $target_database_struct = get_database_struct(TARGET_LINK, TARGET_DB);
    //以数据源为准,比较差异
    foreach ($source_database_struct as $table_name => $create_table) {
        if (!$target_database_struct[$table_name]) {
            execute($create_table, TARGET_LINK);
        } else {
            //比较字段
            compare_column(SOURCE_LINK, TARGET_LINK, SOURCE_DB, TARGET_DB, $table_name);
            //比较索引
            compare_keys(SOURCE_LINK, TARGET_LINK, SOURCE_DB, TARGET_DB, $table_name);
            //比较分区
            compare_partition(SOURCE_LINK, TARGET_LINK, SOURCE_DB, TARGET_DB, $table_name);
        }
    }
    //删除多余的表
    foreach ($target_database_struct as $table_name => $create_table) {
        if (!$source_database_struct[$table_name]) {
            $sql = 'drop table ' . $table_name;
            execute($sql, TARGET_LINK);
        }
    }
    close();
}
Beispiel #6
0
 public static function event()
 {
     $cmd = geolocCmd::byId(init('id'));
     if (!is_object($cmd)) {
         throw new Exception(__('Commande ID geoloc inconnu : ', __FILE__) . init('id'));
     }
     if ($cmd->getEqLogic()->getEqType_name() != 'geoloc') {
         throw new Exception(__('Cette commande n\'est pas de type geoloc : ', __FILE__) . init('id'));
     }
     if ($cmd->getConfiguration('mode') != 'dynamic') {
         throw new Exception(__('Cette commande de géoloc n\'est pas dynamique : ', __FILE__) . init('id'));
     }
     $value = init('value');
     if (strpos($value, 'https://') !== false || strpos($value, 'http://') !== false) {
         $url = parse_url($value);
         parse_str($url['query'], $output);
         if (isset($output['q'])) {
             $value = $output['q'];
         }
         if (isset($output['ll'])) {
             $value = $output['ll'];
         }
     }
     //For compatibility with older version which not use the Value property, set the Value if needed
     foreach ($cmd->getEqLogic()->getCmd('info') as $distance) {
         if ($distance->getConfiguration('mode') == 'distance' || $distance->getConfiguration('mode') == 'travelDistance' || $distance->getConfiguration('mode') == 'travelTime') {
             if ($distance->setDependency()) {
                 $distance->save();
             }
         }
     }
     $cmd->event($value);
     $cmd->getEqLogic()->refreshWidget();
 }
function userPage($modx)
{
    init($modx);
    $myuser = $modx->getObject('kofcuser', array('name' => $modx->user->username), false);
    if ($myuser) {
        $addr = $myuser->getMany('memberMemberAddress', array('addressType' => 'home'));
        foreach ($addr as $a) {
            echo $a->get('street1');
        }
        /*
        	$addr=$modx->newObject('memberAddress');
        	$addr->fromArray(array('addressType'=>'home','street1' => '412 Crofton Park Lane' ,'city'=>'Franklin','state'=>'TN','zip'=>'37069'));
        	$myuser->addMany($addr);
        $myuser->save();
        */
        $baseImage = '/assets/images/memberPhotos/';
        if ($myuser) {
            $imagePath = $baseImage . $myuser->get('imagePath');
        }
        //$mycouncil=$modx->getObject('council',array('id'=>$myuser->get('councilId')));
        $mycouncil = $myuser->getOne('memberCouncil');
        $modx->toPlaceholders(array("imagePath" => $imagePath), '');
        $modx->toPlaceholders($myuser->toArray(), 'member');
        $modx->toPlaceholders($mycouncil->toArray(), 'council');
    }
    return null;
}
function process($form_data)
{
    $a = session_id();
    include "connect.php";
    $conn = init($_SESSION["permission_type"]);
    include "Helper.php";
    //pretty_print_array($form_data);
    $processed_form_data = preprocess($form_data);
    $builder = new GetQueryBuilder();
    $coolresult = $builder->generateSQL($processed_form_data);
    $returnedData = "";
    //print_r($coolresult);
    $returnedData = $conn->query($coolresult["data"][0]);
    //echo ($coolresult["data"][0]);
    $coolresult["data"] = "";
    if ($conn->error) {
        if ($coolresult["error"] == "") {
            $coolresult["error"] = $conn->error;
        }
    } else {
        $coolresult["error"] = "";
        $coolresult["data"] = $returnedData->fetch_all(MYSQLI_ASSOC);
    }
    echo json_encode($coolresult);
}
Beispiel #9
0
 public static function event()
 {
     $cmd = iftttCmd::byId(init('id'));
     if (!is_object($cmd)) {
         throw new Exception('Commande ID ifttt inconnu : ' . init('id'));
     }
     $cmd->event(init('value'));
 }
function getCodecheckProductBySearch($suchbegriff)
{
    $ean = preg_replace('/[^a-zA-Z-0-9]+/', '', $suchbegriff);
    $context = init();
    $r = file_get_contents('http://www.codecheck.info/WebService/rest/prod/search/0/0/30/' . $suchbegriff, false, $context);
    $r = json_decode($r);
    return $r->result;
}
Beispiel #11
0
 /** 
  * Test initialization method.
  */
 public function test_init()
 {
     // Setup
     \WP_Mock::expectAction('wpd_tools_init');
     // Act
     init();
     // Verify
     $this->assertConditionsMet();
 }
Beispiel #12
0
function main()
{
    if ($_SERVER['argc'] <= 1 || false === is_dir($_SERVER['argv'][1])) {
        echo usage();
        exit(-1);
    } else {
        setup();
        init($_SERVER['argv'][1]);
    }
}
Beispiel #13
0
function main()
{
    init();
    connect();
    switch ($GLOBALS['req']['a']) {
        case 'getMembers':
            display('members', getMembers());
            break;
    }
    echo json_encode($GLOBALS['final_print']);
    disconnect();
}
Beispiel #14
0
function generate()
{
    init();
    $sql = 'SHOW TABLES';
    $ret = QueryExecutor::execute(new SqlQuery($sql));
    getnerateDomainObjects($ret);
    getnerateDAOObjects($ret);
    getnerateDAOExtObjects($ret);
    getnerateIDAOObjects($ret);
    createIncludeFile($ret);
    createDAOFactory($ret);
}
/**
 * Grab and push test email data into redis
 * @param $limit_rounds number of times function will execute recursively
 * @param $time_between_rounds number of seconds between each recursive round.
 */
function init($limit_rounds = 10, $time_between_rounds = 5)
{
    $limit_rounds--;
    $email_data_array = json_decode(exec('node test/make-test-data.js 100'));
    foreach ($email_data_array as $key => $email_data_item) {
        queue_email($email_data_item, rand(0, 10));
    }
    if ($limit_rounds > 0) {
        echo "queue_email sleeping. Rounds left: {$limit_rounds}.";
        sleep($time_between_rounds);
        init($limit_rounds);
    }
}
Beispiel #16
0
function tree_nav_table($params, $title, $t_data, $parents = NULL, $i = 1, $id_parent = NULL, $tbody = '')
{
    global $modul;
    foreach ($t_data as $t_key => $t_value) {
        $tbody .= "<div class='table-row'>";
        foreach ($params['TABLE'] as $key => $value) {
            $data = init($t_value[$key], $value, $key);
            if ($value == 'activate') {
                $tbody .= "<div class='table-cell icon-only " . $key . "'>";
                if ($t_value[$key]) {
                    $tbody .= "<a href='#' class='icon-cell " . $key . "_de" . $value . "' data-content='" . $modul . "' id='" . $t_value['id'] . "' ><i class='icon-" . $value . "-active'></i>";
                } else {
                    $tbody .= "<a href='#' class='icon-cell " . $key . "_" . $value . "' data-content='" . $modul . "' id='" . $t_value['id'] . "' ><i class='icon-" . $value . "'></i>";
                }
                $tbody .= "</div><!-- /.table-cell -->";
            } else {
                $tbody .= "<div class='table-cell " . $key . "'>";
                for ($y = 2; $y <= $i; $y++) {
                    $tbody .= "<span class='spacer'></span>";
                }
                $tbody .= "<i class='icon-tree'></i>" . $data . "</div><!-- /.table-cell -->";
            }
        }
        $width = 40 + 26 * count($params['CONSTRUCT']);
        $tbody .= "<div class='table-cell tools' style='width: " . $width . "px;'>";
        foreach ($params['CONSTRUCT'] as $key => $value) {
            if ($value === true) {
                if ($key == 'activate') {
                    if ($t_value['c_active']) {
                        $tbody .= "<a href='#' class='icon-cell de" . $key . "' data-content='" . $modul . "' id='" . $t_value['id'] . "' ><i class='icon-" . $key . "-active'></i>";
                    } else {
                        $tbody .= "<a href='#' class='icon-cell " . $key . "' data-content='" . $modul . "' id='" . $t_value['id'] . "' ><i class='icon-" . $key . "'></i>";
                    }
                    $tbody .= "</a>";
                } else {
                    $tbody .= "<a href='#' class='icon-cell " . $key . "' data-content='" . $modul . "' id='" . $t_value['id'] . "' ><i class='icon-" . $key . "'></i></a>";
                }
            }
        }
        $tbody .= "</div><!-- /.table-cell -->";
        $tbody .= "</div><!-- /.table-row -->";
        if ($t_value['id_parent'] == $id_parent) {
            $i = 1;
        }
        if (isset($t_value['children'])) {
            $tbody .= tree_nav_table($params, $title, $t_value['children'], $parents, $i + 1, $t_value['id_parent'], '');
        }
    }
    return $tbody;
}
Beispiel #17
0
 public static function event()
 {
     $cmd = geolocCmd::byId(init('id'));
     if (!is_object($cmd)) {
         throw new Exception('Commande ID geoloc inconnu : ' . init('id'));
     }
     if ($cmd->getEqLogic()->getEqType_name() != 'geoloc') {
         throw new Exception('Cette commande n\'est pas de type geoloc : ' . init('id'));
     }
     if ($cmd->getConfiguration('mode') != 'dynamic') {
         throw new Exception('Cette commande de géoloc n\'est pas dynamique : ' . init('id'));
     }
     $cmd->event(init('value'));
 }
Beispiel #18
0
 /**
  * Initializes the dataface framework.
  */
 function df_init($site_path, $dataface_url, $conf = null)
 {
     require_once dirname(__FILE__) . '/init.php';
     init($site_path, $dataface_url);
     import('PEAR.php');
     import('Dataface/Application.php');
     $app = Dataface_Application::getInstance($conf);
     if (df_get_file_system_version() != df_get_database_version()) {
         $res = df_update();
         if (PEAR::isError($res)) {
             trigger_error($res->getMessage(), E_USER_ERROR);
         }
     }
     return $app;
 }
function start()
{
    session_start();
    checkAnswerButtonPressed();
    if (isset($_POST['next'])) {
        // next button geklikt
        $_SESSION['nieuweVraag'] = true;
        $_SESSION['vraag'] = $_SESSION['vraag'] + 1;
        unset($_SESSION['buttonGeklikt']);
    } else {
        if (isset($_SESSION['buttonGeklikt'])) {
            // antwoord-button geklikt
            $_SESSION['nieuweVraag'] = false;
        } else {
            // geen button geklikt, eerste vraag
            init();
        }
    }
}
Beispiel #20
0
function send_mail($recipients, $subject, $message)
{
    $mail = init(json_decode(file_get_contents("config/config.json"), true)["mail"]);
    $mail->isHTML(ture);
    if (is_array($recipients)) {
        foreach ($recipients as $recipient) {
            $mail->addAddress($recipient);
        }
    } else {
        $mail->addAddress($recipients);
    }
    $mail->Subject = $subject;
    $mail->Body = $message;
    if (!$mail->send()) {
        return array("success" => false, "message" => $mail->ErrorInfo);
    } else {
        return array("success" => true);
    }
}
Beispiel #21
0
function main()
{
    init();
    connect();
    switch ($GLOBALS['req']['a']) {
        case 'getSongs':
            display('songs', getSongs());
            break;
        case 'getSongsMin':
            display('songsMin', getSongsMin());
            break;
        case 'add100':
            add100();
            display('done', 0);
            break;
    }
    echo json_encode($GLOBALS['final_print']);
    disconnect();
}
Beispiel #22
0
function data_chart($data_points, $i, $max, $size_y = 300, $step = 100, $left = 20)
{
    $chart = "<polyline class='chart_line color-" . $i . "' points='";
    $x = $left;
    foreach ($data_points as $key => $value) {
        $y = $size_y - $size_y / $max * $value + 20;
        $chart .= $x . "," . $y . " ";
        $x += $step / (count($data_points) - 1);
    }
    $chart .= "' />";
    $chart .= "<g class='data color-" . $i . "'>";
    $x = $left;
    foreach ($data_points as $key => $value) {
        $y = $size_y - $size_y / $max * $value + 20;
        $chart .= "<circle cx='" . $x . "' cy='" . $y . "' data-info = '" . $value . "' r='4'><title>" . init($value, 'number') . "</title></circle>";
        $x += $step / (count($data_points) - 1);
    }
    $chart .= "</g>";
    return $chart;
}
Beispiel #23
0
/**
 * Create package.xml
 *
 * @param   boolean $debug
 * @return  void
 */
function main($debug = true)
{
    if (file_exists(PACAGE_XML)) {
        fputs(STDOUT, 'ignore existing package.xml? [y/N]: ');
        $noChangeLog = 0 === strncasecmp(trim(fgets(STDIN)), 'y', 1);
    } else {
        $noChangeLog = false;
    }
    if ($noChangeLog) {
        rename(PACAGE_XML, PACAGE_XML . '.orig');
    }
    $package = init(configure(PACAGE_YML));
    $package->generateContents();
    if ($debug) {
        $package->debugPackageFile();
        if ($noChangeLog) {
            rename(PACAGE_XML . '.orig', PACAGE_XML);
        }
    } else {
        $package->writePackageFile();
    }
}
Beispiel #24
0
function main()
{
    init();
    switch ($GLOBALS['req']['a']) {
        case 'getSongs':
            connect();
            display('songs', getSongs());
            break;
        case 'getSongsMin':
            connect();
            display('songsMin', getSongsMin());
            break;
        case 'add100':
            add100();
            display('done', 0);
            break;
        case 'getMembers':
            connect();
            display('members', getMembers());
            break;
        case 'validate':
            display('valid', validate($GLOBALS['req']['text']));
            break;
        case 'addMember':
            connect();
            addMember();
            break;
        case 'getNewImageName':
            connect();
            display('done', getNewImageName());
            break;
        case 'uploadPicture':
            connect();
            uploadPicture();
            break;
    }
    echo json_encode($GLOBALS['final_print']);
    disconnect();
}
Beispiel #25
0
 public static function event()
 {
     $cmd = virtualCmd::byId(init('id'));
     if (!is_object($cmd)) {
         throw new Exception('Commande ID virtuel inconnu : ' . init('id'));
     }
     $value = init('value');
     $virtualCmd = virtualCmd::byId($cmd->getConfiguration('infoId'));
     if (is_object($virtualCmd)) {
         if ($virtualCmd->getEqLogic()->getEqType_name() != 'virtual') {
             throw new Exception('La cible de la commande virtuel n\'est pas un équipement de type virtuel');
         }
         if ($this->getSubType() != 'slider' && $this->getSubType() != 'color') {
             $value = $this->getConfiguration('value');
         }
         $virtualCmd->setConfiguration('value', $value);
         $virtualCmd->save();
     } else {
         $cmd->setConfiguration('value', $value);
         $cmd->save();
     }
     $cmd->event($value);
 }
Beispiel #26
0
function main($argv, $argc)
{
    $context = init($argv, $argc);
    $sql = $context->sql;
    $result = $sql->query(sprintf("select id, %s from %s", $context->field, $context->table));
    if ($result == null) {
        return 4;
    }
    $field = $context->field;
    $total = 0;
    while ($row = $result->fetch_object()) {
        $text = $row->{$field};
        $count = 0;
        $text = preg_replace($context->find, $context->replace, $text, -1, $count);
        if ($count != 0) {
            echo "replacing {$count} in {$row->id} \n";
            $text = $sql->escape_string(str_replace("%", "%%", $text));
            $sql->query(sprintf("update %s set %s = \"%s\" where id = %d", $context->table, $context->field, $text, $row->id));
        }
        $total += $count;
    }
    echo "\nreplace total: {$total}\n";
    return 0;
}
Beispiel #27
0
 function addItem($file, $data, $location)
 {
     echo 'Slotlist:<br>';
     print_r($this->slotList);
     echo 'data block length ' . strlen($data) . '<br>';
     if (flock($file, LOCK_EX)) {
         // acquire an exclusive lock
         // Read the last item that was saved in this slot and version
         fseek($file, $this->slotList[0] * $this->size + 4);
         $header = unpack('i*', fread($file, 8));
         echo 'VERSION ' . $header[2] . '<p>';
         if ($this->version != $header[2]) {
             /*
             // Reload the information so that you are working with the most current slot list
             $this->slotList = array();
             $nextIndex[1] = $this->start;
             while ($nextIndex[1] > 0) {
             	$this->slotList[] = $nextIndex[1];
             	fseek($file, $nextIndex*$this->size);
             	$nextIndex = unpack('N', fread($file, 4));
             }
             */
             init($this->slotList[0], $file, $this->size);
         }
         if (!$location) {
             $location = sizeof($this->slotData);
         }
         // Check if enough space is available for new items
         $available = sizeof($this->slotList) * ($this->size - 4);
         echo 'Available space: ' . $available . ', Need: ' . ($location * 4 + 24) . '<br>';
         while ($available < $location * 4 + 24) {
             // Will need to get new slot
             $oldEnd = end($this->slotList);
             fseek($file, $this->size - 4, SEEK_END);
             fwrite($file, pack('i', 0));
             $newLoc = ftell($file) / $this->size - 1;
             $this->slotList[] = $newLoc;
             echo 'Add new slot: ' . $newLoc . '<br>';
             fseek($file, $oldEnd * $this->size);
             fwrite($file, pack('N', $newLoc));
             $available = sizeof($this->slotList) * ($this->size - 4);
         }
         $startBlock = intval($location * 4 / ($this->size - 4));
         $endBlock = intval(($location * 4 + strlen($data) - 1) / ($this->size - 4));
         if ($startBlock != $endBlock) {
             echo 'Loc ' . $location . ' Split block -- ' . $startBlock . ' vs ' . $endBlock . '<p>';
             // Need to split the string up
             $startOffset = $location * 4 % ($this->size - 4);
             $part1 = $this->size - 4 - $startOffset;
             $part2 = strlen($data) - $part1;
             echo ' is Start offset = ' . $startOffset . ', Part 1  = ' . $part1 . ', Part 2 = ' . $part2 . '<br>';
             $block1 = substr($data, 0, $part1);
             $block2 = substr($data, $part1);
             $seek1 = $this->slotList[$startBlock] * $this->size + $startOffset + 4;
             $seek2 = $this->slotList[$endBlock] * $this->size + 4;
             echo 'Write block 1 (' . strlen($block1) . ') at location ' . $seek1 . ', and block 2 (' . strlen($block2) . ') at location ' . $seek2 . '<br>';
             fseek($file, $this->slotList[$startBlock] * $this->size + $startOffset + 4);
             fwrite($file, $block1);
             fseek($file, $this->slotList[$endBlock] * $this->size + 4);
             fwrite($file, $block2);
         } else {
             $startOffset = $location * 4 % ($this->size - 4);
             $seekto = $this->slotList[$startBlock] * $this->size + $startOffset + 4;
             echo 'Write Data (' . strlen($data) . ') at slot (' . $this->slotList[$startBlock] . ') at pos (' . $seekto . '):';
             print_r(unpack('i*', $data));
             fseek($file, $this->slotList[$startBlock] * $this->size + $startOffset + 4);
             fwrite($file, $data);
         }
         // increment the update and count
         $seekto = $this->slotList[0] * $this->size + 4;
         echo '<br>Go to ' . $seekto . ' and write header';
         fseek($file, $this->slotList[0] * $this->size + 4);
         fwrite($file, pack('i*', $header[1] + 1, $header[2] + 1));
         fflush($file);
         flock($file, LOCK_UN);
         // release the lock
     }
 }
Beispiel #28
0
 * 
 * PHP versions 4 and 5
 * 
 * @category  FCMS
 * @package   FamilyConnections
 * @author    Ryan Haudenschilt <*****@*****.**> 
 * @copyright 2007 Haudenschilt LLC
 * @license   http://www.gnu.org/licenses/gpl-2.0.html GPLv2
 * @link      http://www.familycms.com/wiki/
 */
session_start();
define('URL_PREFIX', '');
define('GALLERY_PREFIX', 'gallery/');
require 'fcms.php';
load('familynews', 'datetime');
init();
$fnews = new FamilyNews($fcmsError, $fcmsDatabase, $fcmsUser);
$page = new Page($fcmsError, $fcmsDatabase, $fcmsUser, $fnews);
exit;
class Page
{
    private $fcmsError;
    private $fcmsDatabase;
    private $fcmsUser;
    private $fcmsFamilyNews;
    private $fcmsTemplate;
    /**
     * Constructor
     * 
     * @return void
     */
Beispiel #29
0
 * You should have received a copy of the GNU General Public License
 * along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
 */
try {
    require_once dirname(__FILE__) . '/../../core/php/core.inc.php';
    include_file('core', 'authentification', 'php');
    if (!isConnect('admin')) {
        throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
    }
    if (init('action') == 'remove') {
        $connection = connection::byId(init('id'));
        if (!is_object($connection)) {
            throw new Exception(__('Connexion inconnue. Vérifiez l\'id', __FILE__));
        }
        $connection->remove();
        ajax::success();
    }
    if (init('action') == 'ban') {
        $connection = connection::byId(init('id'));
        if (!is_object($connection)) {
            throw new Exception(__('Connexion inconnue. Vérifiez l\'id', __FILE__));
        }
        $connection->setStatus('Ban');
        $connection->save();
        ajax::success();
    }
    throw new Exception(__('Aucune méthode correspondante à : ', __FILE__) . init('action'));
    /*     * *********Catch exeption*************** */
} catch (Exception $e) {
    ajax::error(displayExeption($e), $e->getCode());
}
Beispiel #30
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/core/Core/init.php';
init('minimal');
echo shopUpdates();
function shopUpdates()
{
    //Update the database changes
    try {
        //update module name
        \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Shop' WHERE `id` = 16");
        //update navigation url
        \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Shop' WHERE `area_id` = 13");
        //Insert component entry
        \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('16', 'Shop', 'module')");
        //update module name for frontend pages
        \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Shop' WHERE `module` = 'shop'");
        //update module name for crm core settings
        \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'Shop' WHERE `section` = 'shop'");
        //update module name for email templates
        \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_mail_template` SET `section` = 'Shop' WHERE `section` = 'shop'");
        \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_text` SET `section` = 'Shop' WHERE `section` = 'shop'");
    } catch (\Cx\Lib\UpdateException $e) {
        return "Error: {$e->sql}";
    }
    //Update script for moving the folder
    $shopImgPath = ASCMS_DOCUMENT_ROOT . '/images';
    $shopMediaPath = ASCMS_DOCUMENT_ROOT . '/media';
    try {
        if (file_exists($shopImgPath . '/shop') && !file_exists($shopImgPath . '/Shop')) {
            \Cx\Lib\FileSystem\FileSystem::makeWritable($shopImgPath . '/shop');