Skip to content

Commit 74a4b62

Browse files
committed
Initial commit. Setup jframework
1 parent 059630c commit 74a4b62

File tree

996 files changed

+213436
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

996 files changed

+213436
-0
lines changed

.buildpath

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<buildpath>
3+
<buildpathentry kind="src" path=""/>
4+
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
5+
</buildpath>

.cache/.dataModel

410 KB
Binary file not shown.

.cache/.wsdlDataModel

7.79 KB
Binary file not shown.

.htaccess

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<IfModule mod_rewrite.c>
2+
RewriteEngine On
3+
RewriteCond %{QUERY_STRING} (.*)
4+
RewriteRule ^(.*)$ _japp/loader.php?__r=$1&%1
5+
6+
7+
#RewriteCond %{query_string} ^(.*)
8+
#RewriteRule (.*) _japp/loader.php?__r=$1&%1
9+
</IfModule>

.project

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>Pro</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.wst.validation.validationbuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.dltk.core.scriptbuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.php.core.PhpIncrementalProjectBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>org.eclipse.php.core.ValidationManagerWrapper</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>org.eclipse.php.core.PHPNature</nature>
31+
</natures>
32+
</projectDescription>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Mon May 18 22:37:04 IRST 2009
2+
com.zend.php.javabridge.core.javabridge_entries=
3+
com.zend.php.javabridge.core.project_is_default_jre=true
4+
com.zend.php.javabridge.core.project_jre=System Default JRE;/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
5+
eclipse.preferences.version=1

.settings/org.eclipse.php.core.prefs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#Mon May 18 22:37:04 IRST 2009
2+
eclipse.preferences.version=1
3+
phpVersion=php5
4+
use_asp_tags_as_php=false
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Mon May 18 22:37:04 IRST 2009
2+
eclipse.preferences.version=1
3+
org.eclipse.php.core.contextRoot=
4+
org.eclipse.php.core.defaultEncoding=
5+
org.eclipse.php.core.includePath=<?xml version\="1.0" encoding\="UTF-8"?>\n<includepath>\n</includepath>\n

TODO

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#TODO: add view detector in hooks, as a callback member of base view class
2+
#FIXME: sessions are somewhat buggy, fix them
3+
4+
__DONE__
5+
1047 #TODO: add embed.php to root of jframework for embedded mode
6+
1048 #TODO: add transition scripts based on versions
7+
1047 #TODO: allow multiple runs in a single process
8+
1078 #FIXME: add index page to all requests with /"" at end of them
9+
1025 #FIXME: rename jFramework in loader to jframework
10+
1048 #FIXME: Http::Root() only returns valid when Request is set via .htaccess, not in embed mode

_japp/config/.htaccess

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
order allow,deny
2+
deny from all

_japp/config/main.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
namespace jf;
3+
4+
const version="4.21";
5+
6+
const WHOAMI="jframework 4.21";
7+
8+
9+
10+
11+
12+
?>

_japp/control/.htaccess

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
order allow,deny
2+
deny from all

_japp/control/__rbac.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
if (\jf\HttpRequest::File()=="sys/login" or \jf\HttpRequest::File()=="sys/logout") return;
3+
4+
if (!j::UserID())
5+
header("location: ".SiteRoot."/sys/login?return=/{\jf\HttpRequest::File()}");
6+
else
7+
if (!j::$RBAC->Check("panel"))
8+
j::$RBAC->Enforce("root");
9+
?>

_japp/control/main.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
namespace jf;
3+
class MainController extends Controller
4+
{
5+
function Start ()
6+
{
7+
return $this->Present();
8+
}
9+
}
10+
?>

_japp/control/users/add.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
class UsersAddController extends BaseControllerClass
3+
{
4+
function Start()
5+
{
6+
$App=$this->App;
7+
$View=$this->View;
8+
# Put your logic here
9+
if (isset($_POST["Username"]))
10+
{
11+
$r=$App->Session->CreateUser($_POST['Username'],$_POST['Password']);
12+
echo "Create user result: ".($r?"success":"failure");
13+
if (!$r) echo " (Username already exists!)";
14+
echo "<hr/>";
15+
}
16+
17+
18+
$this->Present();
19+
}
20+
}
21+
?>

_japp/control/users/assign.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
class UsersAssignController extends BaseControllerClass
3+
{
4+
function Start()
5+
{
6+
$View=$this->View;
7+
8+
if (isset($_POST['rid']))
9+
{
10+
$Replace=$_POST['Replace'];
11+
if ($_POST['rid'])
12+
foreach ($_POST['rid'] as $R)
13+
{
14+
if ($_POST['uid'])
15+
foreach ($_POST['uid'] as $U)
16+
{
17+
$this->App->RBAC->User_AssignRole($R,$U,$Replace);
18+
}
19+
}
20+
$View->Result=count($_POST['rid'])*count($_POST['uid']);
21+
22+
}
23+
24+
$Userman=new SystemUsersModel($this->App);
25+
$View->Users=$Userman->AllUsers();
26+
$View->Roles=$this->App->RBAC->Role_All();
27+
28+
$this->Present();
29+
}
30+
}
31+
?>

_japp/control/users/edit.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
class UsersEditController extends BaseControllerClass
3+
{
4+
function Start()
5+
{
6+
$App=$this->App;
7+
$View=$this->View;
8+
# Put your logic here
9+
$Users=new SystemUsersModel($App);
10+
$View->Count=$Users->UserCount();
11+
if (isset($_POST['uid'])) //edit user
12+
{
13+
$UserID=$_POST['uid'];
14+
$Username=$_POST['Username'];
15+
$Password=$_POST['Password'];
16+
if ($Password=="") $Password=null;
17+
$Result=$App->Session->EditUser($App->Session->Username($UserID),$Username,$Password);
18+
if ($Result)
19+
{
20+
echo "Edit successful.";
21+
}
22+
elseif ($Result==false)
23+
{
24+
echo "The new username you specified already exists!";
25+
}
26+
elseif ($Result==null)
27+
{
28+
echo "The old username you specified does not exist!";
29+
}
30+
echo "<hr/><a href='?' >Back</a>";
31+
}
32+
elseif (isset($_GET['uid'])) //selected user
33+
{
34+
$View->User=$Users->User($_GET['uid']);
35+
$View->User=$View->User[0];
36+
37+
38+
}
39+
else //user list
40+
{
41+
$limit=30;
42+
$offset=0;
43+
if (isset($_GET['limit']))
44+
$limit=$_GET['limit'];
45+
if (isset($_GET['offset']))
46+
$offset=$_GET['offset'];
47+
48+
$View->Users=$Users->AllUsers($offset,$limit);
49+
$View->Offset=$offset;
50+
$View->Limit=$limit;
51+
}
52+
$this->Present();
53+
}
54+
}
55+
?>

_japp/control/users/online.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
class UsersOnlineController extends BaseControllerClass
3+
{
4+
function Start()
5+
{
6+
$App=$this->App;
7+
$Users=new SystemUsersModel($App);
8+
$this->View->Sessions=$Users->AllSessions();
9+
$this->Present();
10+
}
11+
}
12+
?>

_japp/control/users/remove.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
class UsersRemoveController extends BaseControllerClass
3+
{
4+
function Start()
5+
{
6+
$App=$this->App;
7+
$View=$this->View;
8+
# Put your logic here
9+
$Users=new SystemUsersModel($App);
10+
$View->Count=$Users->UserCount();
11+
if (isset($_POST['sel'])) //edit user
12+
{
13+
foreach($_POST['sel'] as $v)
14+
{
15+
$App->Session->RemoveUser($App->Session->Username($v));
16+
}
17+
echo "A total number of ".count($_POST['sel'])." users where removed.<hr/><a href='?'>Back</a>";
18+
}
19+
else //user list
20+
{
21+
$limit=30;
22+
$offset=0;
23+
if (isset($_GET['limit']))
24+
$limit=$_GET['limit'];
25+
if (isset($_GET['offset']))
26+
$offset=$_GET['offset'];
27+
28+
$View->Users=$Users->AllUsers($offset,$limit);
29+
$View->Offset=$offset;
30+
$View->Limit=$limit;
31+
}
32+
$this->Present();
33+
}
34+
}
35+
?>

_japp/control/users/unassign.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
class UsersUnassignController extends BaseControllerClass
3+
{
4+
function Start()
5+
{
6+
$View=$this->View;
7+
if (isset($_POST['a']))
8+
{
9+
foreach($_POST['a'] as $A)
10+
{
11+
$A=explode("_",$A);
12+
if ($A[0]=='0' && $A[1]=='0')
13+
$View->Result="Can not unassign root.";
14+
else
15+
$this->App->RBAC->User_UnassignRole($A[0],$A[1]);
16+
}
17+
$View->Result=count($_POST['a']);
18+
}
19+
$View->Assignments=$this->App->RBAC->User_AllAssignments(false,$_GET['sort'],$_GET['offset'],$_GET['limit']);
20+
$View->Count=$this->App->RBAC->User_AllAssignmentsCount();
21+
22+
$this->Present();
23+
}
24+
}
25+
?>

_japp/control/xuser/__rbac.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php

_japp/control/xuser/login.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
class XuserLoginController extends JControl
3+
{
4+
function Start ()
5+
{
6+
$this->Username=jf::$XUser->Username();
7+
$Logged=false;
8+
if (isset($_COOKIE["jframework_rememberme"]))
9+
{
10+
$rememberMeToken= $_COOKIE["jframework_rememberme"];
11+
$userID=jf::LoadGeneralSetting("rememberme_".$rememberMeToken);
12+
if ($userID>0)
13+
{
14+
$Result=jf::$XUser->ForceLogin($userID);
15+
$Logged=true;
16+
}
17+
}
18+
if (isset($_POST["Username"]))
19+
{
20+
$Username=$_POST['Username'];
21+
$Password=$_POST['Password'];
22+
$loginResult=jf::$XUser->Login($Username, $Password);
23+
if ($loginResult==false)
24+
{
25+
$UserID=jf::$XUser->UserID($Username);
26+
$res=jf::$XUser->LastError;
27+
if ($res==\jf\ExtendedUserErrors::Inactive)
28+
$ErrorString="Your account is not activated.";
29+
elseif ($res==\jf\ExtendedUserErrors::InvalidCredentials or $res==\jf\ExtendedUserErrors::NotFound)
30+
$ErrorString="Invalid Credentials.";
31+
elseif ($res==\jf\ExtendedUserErrors::Locked)
32+
$ErrorString="Your account is locked. Try again in ".floor(jf::$XUser->LockTime($Username)/60)." minute(s).";
33+
elseif ($res==\jf\ExtendedUserErrors::PasswordExpired)
34+
{
35+
$Link=("./reset?user={$UserID}");
36+
$ErrorString="Your password is expired. You should <a href='{$Link}'>change your password</a>.";
37+
}
38+
elseif ($res==\jf\ExtendedUserErrors::TemporaryValidPassword)
39+
{
40+
$Link=("./reset?user={$UserID}&temp={$Password}");
41+
$ErrorString="This is a temporary password. You should <a href='{$Link}'>reset your password</a> now.";
42+
}
43+
$Logged=false;
44+
$this->Error=$ErrorString;
45+
}
46+
else //logged in successfully
47+
{
48+
$Logged=true;
49+
if (isset($_POST['Remember']))
50+
{
51+
$timeout=60*60*24*30;
52+
$rememberMeToken=jf::$Security->RandomToken();
53+
jf::SaveGeneralSetting("rememberme_".$rememberMeToken,jf::CurrentUser(),$timeout);
54+
setcookie('jframework_rememberme',$rememberMeToken,jf::time()+$timeout);
55+
}
56+
}
57+
}
58+
if ($Logged==true)
59+
{
60+
if (isset($_GET['return']))
61+
$this->Redirect($_GET['return']);
62+
$this->Success=true;
63+
}
64+
65+
return $this->Present();
66+
}
67+
}
68+
?>

0 commit comments

Comments
 (0)