This commit is contained in:
mynah
2020-01-22 18:22:31 -06:00
parent f16d579996
commit 174f4b0756
38 changed files with 503 additions and 473 deletions

View File

@@ -30,17 +30,6 @@ sub pang_md{
return \%h;
}
sub calendar_monthblock {
return _read ($data_path->child("cal/q1Block.q")->slurp);
}
sub calendar_events {
return _read ($data_path->child("cal/q3Event.q")->slurp);
}
sub event{
my ($c,$id)=@_;
return shift @{ _read ($data_path->child("event/qEvent.q")->slurp,$id)};
}
sub tv_videos{
return _read ($data_path->child("/tv/qSeries.q")->slurp); #group,name
}
@@ -57,57 +46,29 @@ sub podcast_infoHash{
#==============================================================================
# Read vdg admin ==============================================================
sub msg_heads{
my ($self,@bind)=@_;
my @empty;
my $q= $data_path->child("/admin/mensajes/qEntries.q")->slurp;
my $dbh = DBI->connect("DBI:mysql:".Dojo::Conf::MSGDB.":".Dojo::Conf::MSGDB_H,Dojo::Conf::MSGDB_UR,Dojo::Conf::MSGDB_URP,{mysql_enable_utf8 => 1});
return \@empty unless($dbh);
my $h=$dbh->selectall_arrayref($q,{ Slice => {} },@bind)//"error";
#((col1=>d1,col2=>d1),(col1=>d2,col2=>d2))
$dbh->disconnect();
return $h;
}
sub msg_heads{
my ($self,@bind)=@_;
my @empty;
my $q= $data_path->child("/admin/mensajes/qEntries.q")->slurp;
my $dbh = DBI->connect("DBI:mysql:".Dojo::Conf::MSGDB.":".Dojo::Conf::MSGDB_H,Dojo::Conf::MSGDB_UR,Dojo::Conf::MSGDB_URP,{mysql_enable_utf8 => 1});
return \@empty unless($dbh);
my $h=$dbh->selectall_arrayref($q,{ Slice => {} },@bind)//"error";
#((col1=>d1,col2=>d1),(col1=>d2,col2=>d2))
$dbh->disconnect();
return $h;
}
sub msg{
my ($c,@bind)=@_;
my @empty;
my $q= $data_path->child("/admin/mensajes/json/qGetInfo.q")->slurp;
my $dbh = DBI->connect("DBI:mysql:".Dojo::Conf::MSGDB.":".Dojo::Conf::MSGDB_H,Dojo::Conf::MSGDB_UR,Dojo::Conf::MSGDB_URP,{mysql_enable_utf8 => 1});
return \@empty unless($dbh);
my $h=$dbh->selectall_arrayref($q,{ Slice => {} },@bind)//\@empty;
#((col1=>d1,col2=>d1),(col1=>d2,col2=>d2))
$dbh->disconnect();
return shift @$h;
}
sub user_heads{
return _readgrulla($data_path->child("admin/tienda/qUsers.q")->slurp);
}
sub store_heads{
return _readgrulla($data_path->child("admin/tienda/qStore.q")->slurp);
}
sub user {
return shift @{_readgrulla($data_path->child("admin/tienda/json/qUsers.q")->slurp,pop)}}
sub astore {
return shift @{_readgrulla($data_path->child("/admin/tienda/json/qStore.q")->slurp,pop)}}
sub courses{ return _read("select nombre as name, id from curso;")}
sub course { return shift @{_read($data_path->child("/admin/event/json/qCourse.q")->slurp,pop)}}
sub places { return _read("select nombre as name, id from lugar;")}
sub place { return shift @{_read($data_path->child("/admin/event/json/qPlace.q")->slurp,pop)}}
sub months { return _read("select nombre as name, id from mes;")};
sub events { return _read($data_path->child("/admin/event/qEprev.q")->slurp)}
sub eventa { return shift @{_read($data_path->child("/admin/event/json/qEvent.q")->slurp,pop)}}
# sub eimgList{ return [get_names("public/home/cal/img/")] }
sub eimgList{
my $dp = path('public/home/cal/img')->make_path;
return [ map{ $_->basename} grep{/(jpg|png)$/i}@{$dp->list} ];
}
sub msg{
my ($c,@bind)=@_;
my @empty;
my $q= $data_path->child("/admin/mensajes/json/qGetInfo.q")->slurp;
my $dbh = DBI->connect("DBI:mysql:".Dojo::Conf::MSGDB.":".Dojo::Conf::MSGDB_H,Dojo::Conf::MSGDB_UR,Dojo::Conf::MSGDB_URP,{mysql_enable_utf8 => 1});
return \@empty unless($dbh);
my $h=$dbh->selectall_arrayref($q,{ Slice => {} },@bind)//\@empty;
#((col1=>d1,col2=>d1),(col1=>d2,col2=>d2))
$dbh->disconnect();
return shift @$h;
}
#==============================================================================
# Write vdg user ==============================================================
@@ -116,7 +77,7 @@ sub contact{
my $q="insert into entrada (nombre,correo,pagina,texto,fecha) values(?,?,?,?,now() )" ;
my @a=@_;
#simple method to ignore spam
return _writemsg($q,@a) unless $a[3]=~m/http|website|\<a|feedback|forms|suscribe|advertise|newsletter|promotion|Madam|Sir/;
return _writemsg($q,@a) unless $a[3]=~m/http|website|\<a|feedback|forms|suscribe|investment|funding|site|company|advertise|newsletter|promotion|Madam|Sir/;
return 0;
}
#==============================================================================
@@ -127,35 +88,6 @@ sub umod{
return _write($q,@_);
}
sub event_del { return _write("delete from evento where id = ?;",pop);}
sub course_del{ return _write("delete from curso where id = ?;",pop); }
sub place_del { return _write("delete from lugar where id = ?;",pop); }
sub event_up{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/add/qEup.q")->slurp,@bind);
}
sub course_up{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/add/qCup.q")->slurp,@bind);
}
sub place_up{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/add/qPup.q")->slurp,@bind);
}
sub event_ch{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/change/qEup.q")->slurp,@bind);
}
sub course_ch{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/change/qCup.q")->slurp,@bind);
}
sub place_ch{
my ($self,@bind)=@_;
return _write($data_path->child("/admin/event/change/qPup.q")->slurp,@bind);
}
#==============================================================================
#ayudas =====================================