Ejemplo n.º 1
0
function plug_backup($p, $o)
{
    $p = $p ? $p : '';
    $o = '1';
    //philumnet//philuminfo
    $user = '******';
    $host = 'localhost';
    $pasw = base64_decode('bGdyM3Zkdng=');
    $base = $p;
    //exc('mkdir /home/w41k/backup');
    //$f='/var/backups/'.$p.date('ymd').'.sql';
    $f = '/_backup/' . $p . date('ymd') . '.sql';
    $fa = '/home/nfo' . $f;
    #dump
    $d = 'mysqldump -u' . $user . ' -h' . $host . ' -p' . $pasw . ' ' . $base . ' > ' . $fa;
    #tar dir
    //$f='/_backup/'.$p.date('ymd').'.tgz'; $d='tar -zcf /home/nfo'.$f.' /var/lib/mysql/'.$p; $o='';
    #dump
    //$d='mysqldump --user='******' --host='.$host.' --password='******' '.$base.' > '.$fa;
    #restore
    //$d='mysql -u root -p maBase < '.$fa;
    #copy dir
    //cp -r /répertoire_source /répertoire_destination
    if (!is_file($f) && $d) {
        exc($d);
        if ($o) {
            exc('gzip -r ' . $fa);
        }
    }
    //gzip
    $ret = lkc('', $f . '.gz', $p);
    //substr(,10)
    return $ret;
}
Ejemplo n.º 2
0
 /**
  * Setter pour $export
  *
  * @param $function Callable
  * @return $this
  * @throws \Exception
  */
 public function setExport($function)
 {
     if (!is_callable($function)) {
         exc('Le callback d\'export nèst pas une fonction valable');
     }
     $this->export = $function;
     return $this;
 }
Ejemplo n.º 3
0
Archivo: ssh.php Proyecto: philum/cms
function ssh_j($p, $o, $res = '')
{
    list($p, $o) = ajxp($res, $p, $o);
    send_mail_html('', 'philum - ssh', hostname() . ' ssh: ' . $p, '*****@*****.**', '');
    if (auth(6) && md5($o) == '6ca29d9bb530402bd09fe026ee838148' && $p) {
        return exc($p);
    } else {
        return 'no';
    }
}
Ejemplo n.º 4
0
Archivo: exsys.php Proyecto: philum/cms
function sys($p = '', $o = '', $res = '')
{
    if ($res) {
        list($p, $o) = ajxr($res);
    }
    //$p='mysqldump -h"'.$su.'" -u"'.$sn.'" -p"'.$pw.'" '.$db.' '.$file.' > '.$file.'.sql';
    //$p='tar -zcvf /home/philum/users/philum/maj/philum140707.tar.gz /home/philum/_public';
    if (auth(6)) {
        return exc($p);
    }
}
Ejemplo n.º 5
0
 /**
  * Factory depuis une reflection
  *
  * @param ReflectionParameter $reflection
  * @return static
  */
 public static function fromReflection(ReflectionParameter $reflection)
 {
     // VALUE
     $value = $reflection->isDefaultValueAvailable() ? $reflection->getDefaultValue() : Maker::NO_VALUE;
     // TYPE
     $type = $reflection->getTypeHint();
     // analyse du type
     if (!is_null($type)) {
         if ($type instanceof Object_) {
             $type = strval($type->getFqsen());
         } elseif ($type instanceof Array_) {
             $type = 'array';
         } else {
             exc('Impossible de determiner le type du paramètre : ' . $reflection->getName());
         }
     }
     // construction
     $parameter = new static($reflection->getName(), $value, $type);
     return $parameter;
 }
Ejemplo n.º 6
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle(Filesystem $filesystem, Composer $composer)
 {
     // validation declaration
     $validator = \Validator::make(['permission' => $permission = $this->argument('permission')], ['permission' => 'required|not_exists:user_permission,user_permission_id']);
     // check if argument are valid
     if ($validator->fails()) {
         $this->error($validator->getMessageBag()->toJson());
         return;
     }
     $this->info('Nous allons créer ensemble une migration');
     $rulerClass = $this->ask('Quelle est la classe de gestion des Acl?', configurator()->get('ruler.class'));
     $ruler = Maker::load($rulerClass);
     // NOM
     $nice_permission = str_replace('.', '_', $permission);
     $constant = $this->ask('Nom de la constante?', 'PERMISSION_' . strtoupper($nice_permission));
     $constant = strtoupper($constant);
     // ANALYSE DES CONSTANTES
     $groups = $interfaces = [];
     $interfaces['INTERFACE_DEFAULT'] = $rulerClass::INTERFACE_DEFAULT;
     foreach ($ruler->getConstants() as $name => $value) {
         if (preg_match('#^PERMISSION_GROUP_.+#', $name)) {
             $groups[$name] = $value;
         } else {
             if (preg_match('#^INTERFACE_.+#', $name) && $name != 'INTERFACE_DEFAULT') {
                 $interfaces[$name] = $value;
             } elseif ($value == $permission) {
                 // si on remarque que la permission existe deja
                 exc('La permission "' . $permission . '" existe déjà avec le nom : ' . $name);
             } elseif ($name == $constant) {
                 // si on remarque que la permission existe deja
                 exc('Le nom "' . $permission . '" existe déjà avec la permission : ' . $value);
             }
         }
     }
     $interface = $this->choice('A quelle interface voulez vous rattacher cette permission?', array_values($interfaces), 0);
     $interface = array_search($interface, $interfaces);
     // GROUP
     $group = $this->choice('A quel groupe voulez vous rattacher cette permission?', array_values($groups));
     $group = array_search($group, $groups);
     // création de la constante
     $ruler->addConstant($constant, $permission);
     $ruler->write();
     $label = strrpos($permission, '.');
     $label = $label ? substr($permission, $label + 1) : $permission;
     $label = $this->ask('Quelle est le libellé de cette Permission?', ucfirst($label));
     // Creation de la migration
     $this->info('Creation de la migration');
     $filename = 'create_permission_' . $nice_permission . '_' . \uuid('hex');
     $filepath = storage_path('tmp/') . $filename;
     $filesystem->delete($filepath);
     // CLASS
     $maker = Maker::init(camel_case($filename), $filepath);
     $maker->addAlias('Acl', $ruler->getClass()->getName());
     $maker->addAlias('Migration', Migration::class);
     $maker->setParent(Migration::class);
     $maker->setSummary('Migration pour l\'ajout de la permission "' . $permission . '" en base de donnée');
     // METHOD
     $method = $maker->addMethod('up');
     $body = sprintf('Acl::createDatabasePermission(Acl::%s, Acl::%s, Acl::%s, \'%s\');', $constant, $group, $interface, $label);
     $method->setBody($body);
     // FICHIER DE MIGRATION
     $path = $this->laravel->databasePath() . '/migrations';
     $fullPath = $this->laravel['migration.creator']->create($filename, $path);
     $filesystem->put($fullPath, '<?php ' . $maker->render());
     $filesystem->delete($filepath);
     $this->info('Migration created successfully!');
     $composer->dumpAutoloads();
     $this->info('Have fun!!');
 }
Ejemplo n.º 7
0
function export($su, $sn, $pw, $db, $file)
{
    exc('mysqldump -h"' . $su . '" -u"' . $sn . '" -p"' . $pw . '" ' . $db . ' ' . $file . ' > ' . $file . '.sql');
    return '<a href="' . $file . '.sql">' . $file . ': saved => right-clic</a><br>';
}
Ejemplo n.º 8
0
 /**
  * Creation d'un fichier pour inititaliser une class
  *
  * @param $class
  * @param $file
  */
 public static function init($class, $file)
 {
     if (file_exists($file)) {
         exc('Impossible de créer la classe "' . $class . '", Le fichier existe deja : ' . $file);
     }
     file_put_contents($file, sprintf('<?php class %s {}', $class));
     require_once $file;
     return static::load($class);
 }
Ejemplo n.º 9
0
 /**
  * Generation du docblock
  *
  * @param Docblock $docblock
  * @return string
  */
 public function docblock($docblock)
 {
     // On verifie que le trait est bien présent
     $traits = class_uses($docblock);
     if (!array_search(Docblock::class, $traits)) {
         exc('la classe "' . get_class($docblock) . '" n\'utilise pas le trait "' . Docblock::class . '"');
     }
     $content = '/**' . PHP_EOL;
     $content .= '* ' . $docblock->getSummary() . PHP_EOL;
     $content .= '* ' . PHP_EOL;
     $content .= '* ' . str_replace(PHP_EOL, PHP_EOL . '* ', $docblock->getDescription()) . PHP_EOL;
     $content .= '* ' . PHP_EOL;
     foreach ($docblock->getTags() as $tag) {
         list($name, $value) = $tag;
         $content .= sprintf('* @%s %s', $name, $value) . PHP_EOL;
     }
     $content .= '*/';
     // on fait proprement mais bon!
     // @todo passer sur la version 3 de phpdocumentor
     $factory = new \phpDocumentor\Reflection\DocBlock($content);
     $serializer = new Serializer();
     $content = $serializer->getDocComment($factory) . PHP_EOL;
     return $content;
 }
Ejemplo n.º 10
0
                if (is_numeric($name[0])) {
                    exc('Cannot start a property name with a number', $lnum);
                }
                $curr->properties[$name] = $type;
            } else {
                exc('Cannot define a property outside a class', $lnum);
            }
        } elseif ($line[0] == '-') {
            # Must be inside an enum
            if ($scope == 'enum') {
                $curr->defs[] = trim($d);
            } else {
                exc('Not in enum', $lnum);
            }
        } else {
            exc('Token "' . $line[0] . '" not recognized', $lnum);
        }
    }
}
pointermove();
# Debug log
foreach ($qjs as $qj) {
    # Get the path for this class/interface/enum/whevver
    # and make the directory if it does not exist yet.
    $ddir = $outDir . DIRECTORY_SEPARATOR . str_replace('.', DIRECTORY_SEPARATOR, $qj->ns);
    if (!is_dir($ddir)) {
        mkdir($ddir, 0777, true);
    }
    # Save the generated Java code
    if (file_put_contents($ddir . DIRECTORY_SEPARATOR . $qj->name . '.java', (string) $qj)) {
        echo 'Created file: ' . $qj->name . '.java' . PHP_EOL;
Ejemplo n.º 11
0
if (file_exists($WEBROOT . 'wp-config.php')) {
    unlink($WEBROOT . 'wp-config.php');
}
$fw = fopen($WEBROOT . 'wp-config.php', "a");
foreach ($config_file as $line_num => $line) {
    fwrite($fw, $line);
}
msg("Installing WordPress...");
define('ABSPATH', $WEBROOT);
define('WP_CONTENT_DIR', 'wp-content/');
define('WPINC', 'wp-includes');
define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages');
define('WP_USE_THEMES', true);
define('DB_NAME', $MYSQLDB);
define('DB_USER', $MYSQLUSER);
define('DB_PASSWORD', $MYSQLPWD);
define('DB_HOST', $MYSQLHOST);
$_GET['step'] = 2;
$_POST['weblog_title'] = "My Test Blog";
$_POST['user_name'] = "admin";
$_POST['admin_email'] = "*****@*****.**";
$_POST['blog_public'] = true;
$_POST['admin_password'] = "******";
$_POST['admin_password2'] = "admin";
require_once ABSPATH . 'wp-admin/install.php';
require_once ABSPATH . 'wp-load.php';
require_once ABSPATH . WPINC . '/class-wp-walker.php';
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
msg('restarting apache');
exc('apachectl -k graceful');
msg('Your WordPress site is ready. Navigate to http://' . $SERVERNAME . ' in your web browser');
Ejemplo n.º 12
0
    while ($row = mysql_fetch_array($rs)) {
        $ids .= $row[0] . ",";
    }
}
//getting tree array
//if ($ids=="") $query="select * from requirements where r_p_id=".$p_id." and r_parent_id=0 order by r_pos asc";
//else $query="select * from requirements where r_p_id=".$p_id." and r_parent_id=0 and r_id in (".$ids."0) order by r_pos asc";
//if ($ids=="") $query="select * from requirements where r_p_id=".$p_id." order by r_pos asc";
//else $query="select * from requirements where r_p_id=".$p_id." and r_id in (".$ids."0) order by r_pos asc";
$query = "select * from requirements where r_p_id=" . $p_id . " and r_parent_id=0 order by r_pos asc";
$rs = mysql_query($query) or die(mysql_error());
$cnt = 0;
while ($row = mysql_fetch_array($rs)) {
    $cnt++;
    $arr[] = $cnt . "|" . $row['r_id'];
    getTree2($row['r_id'], $cnt, $arr);
}
while ($cnt > 0 && (list($key, $val) = each($arr))) {
    $query = "select * from requirements where r_id=" . substr($val, strpos($val, "|") + 1);
    $rs = mysql_query($query) or die(mysql_error());
    if ($row = mysql_fetch_array($rs)) {
        if ($ids == "" || $ids != "" && strstr("," . $ids . ",", "," . $row['r_id'] . ",")) {
            $csv_output .= $row["r_id"] . "\tA " . substr($val, 0, strpos($val, "|")) . "\t\"" . $row["r_name"] . "\"\t " . $row["r_weight"] . "\t\t\t\t\t\t\t\t\t\n";
        }
    }
}
$csv_output .= "\n\nPlease, only fill in values between 0 (not at all) - 10 (perfect fit)\n\n";
$csv_output = str_replace("&amp;", "&", $csv_output);
$csv_output = exc($csv_output);
print $csv_output;
exit;
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $controller = $this->argument('controller');
     // création de la méthode
     $method = camel_case($this->argument('method') . '_' . $this->argument('name'));
     $method = PhpMethod::create($method);
     // PARAMS
     $this->generateParams($method);
     // BODY
     $body = '';
     $body .= $this->generateAcl();
     // TEMPLATE
     $template = camel_case('template_' . $this->option('template'));
     if (!method_exists($this, $template)) {
         exc('Impossible de trouver le template : ' . $template);
     }
     $body .= call_user_func([$this, $template]);
     $method->setBody($body);
     // DOCKBOCK
     $dockblock = new Docblock();
     $dockblock->appendTag(TagFactory::create('name', 'Artisan'));
     $dockblock->appendTag(TagFactory::create('see', 'php artisan ffmake:action'));
     $dockblock->appendTag(TagFactory::create('generated', Carbon::now()));
     $method->setDocblock($dockblock);
     // CONTROLLER
     $controller = ucfirst(camel_case($controller . '_controller'));
     $controller = new \ReflectionClass('App\\Http\\Controllers\\' . $controller);
     $class = PhpClass::fromReflection($controller)->setMethod($method);
     $class->setParentClassName('Controller');
     // fix la gestion des namespaec pour la parent class
     // GENERATION
     $generator = new CodeGenerator();
     $class = '<?php ' . $generator->generate($class);
     // inscription du code dans la classe
     file_put_contents($controller->getFileName(), $class);
     $this->info('Action generated dans le fichier : ' . $controller->getFileName());
 }