#!/usr/bin/php
<?php
-require('../config/config.inc');
+/*
+ * Script that XXX
+ * Called XXX
+ */
+
+
+// Use relative address of config file
+// Change this, if you move you cron directory.
+$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
+require($dir.'/../wwwroot/config/config.inc');
+
+
//connecting to database and creating universal $db object
-require(SYSTEM_ROOT.'/inc/log.inc');
-require(SYSTEM_ROOT.'/inc/database.inc');
-require(SYSTEM_ROOT.'/inc/nodes.inc');
-require(SYSTEM_ROOT.'/inc/permissions.inc');
-require(SYSTEM_ROOT.'/inc/ubik.inc');
+require(INCLUDE_DIR.'/log.inc');
+require(INCLUDE_DIR.'/database.inc');
+require(INCLUDE_DIR.'/nodes.inc');
+require(INCLUDE_DIR.'/permissions.inc');
+require(INCLUDE_DIR.'/ubik.inc');
$_SESSION['user_id']=UBIK_ID;
$db=new CLASS_DATABASE();
-$set=$db->query("select * from node_access where node_id='1961061' and node_permission='execute'");
+$set=$db->query("select * from node_access where
+ node_id='1961061' and node_permission='execute'");
$citizens=$set->getNumRows();
-$set2=$db->query("select k,node_id,node_creator,login from nodes left join users on nodes.node_creator=users.user_id where node_name='request for citizenship'");
+$set2=$db->query("select k,node_id,node_creator,login from nodes
+ left join users on nodes.node_creator=users.user_id where
+ node_name='request for citizenship'");
echo "TOTAL $citizens citizens \n";
$login=$set2->getString('login');
$citizen=$set2->getString('node_creator');
echo "citizen $citizen - $login has $votes needs ".floor(log($citizens,"1.42"))." \n";
+
if (($citizens<66 && $votes>=floor($citizens/6)) ||
($citizens>=66 && $votes>floor(log($citizens,"1.42")))) {
+
$params['node_parent']=$request_id;
$params['node_creator']=UBIK_ID;
$params['node_content']="request of user $login approved by $votes citizens";
//print_r($params);
echo $votes.$citizen."\n";
nodes::addNode($params);
- $t1=$db->query("select * from node_access where node_id='1961061' and user_id='$citizen' and node_permission='execute'");
- if (!$t1->getNumRows()) $db->query("insert into node_access set node_id='1961061',user_id='$citizen',node_permission='execute'");
- $t1=$db->query("select * from node_access where node_id='1061495' and user_id='$citizen' and node_permission='execute'");
- if (!$t1->getNumRows())
- $db->query("insert into node_access set node_id='1061495',user_id='$citizen',node_permission='execute'");
- $t1=$db->query("select * from node_access where node_id='1961070' and user_id='$citizen' and node_permission='execute'");
- if (!$t1->getNumRows())
- $db->query("insert into node_access set node_id='1961070',user_id='$citizen',node_permission='execute'");
- $db->query("update nodes set node_name='approved citizenship request' where node_id='$request_id'");
+ $t1=$db->query("select * from node_access where
+ node_id='1961061' and
+ user_id='$citizen'
+ and node_permission='execute'");
+ if (!$t1->getNumRows()) {
+ $db->query("insert into node_access set
+ node_id='1961061',
+ user_id='$citizen',
+ node_permission='execute'");
+ }
+ $t1=$db->query("select * from node_access where
+ node_id='1061495' and
+ user_id='$citizen' and
+ node_permission='execute'");
+ if (!$t1->getNumRows()) {
+ $db->query("insert into node_access set
+ node_id='1061495',
+ user_id='$citizen',
+ node_permission='execute'");
+ }
+ $t1=$db->query("select * from node_access where
+ node_id='1961070' and
+ user_id='$citizen' and
+ node_permission='execute'");
+ if (!$t1->getNumRows()) {
+ $db->query("insert into node_access set
+ node_id='1961070',
+ user_id='$citizen',
+ node_permission='execute'");
+ }
+ $db->query("update nodes set node_name='approved citizenship request'
+ where node_id='$request_id'");
$params['mail_to']=$citizen;
$params['mail_text']="you have become a citizen";
ubik::ubikMail($params);
-
}
}
-
-
-
?>
<?php
require('../config/config.inc');
//connecting to database and creating universal $db object
-require(SYSTEM_ROOT.'/inc/log.inc');
-require(SYSTEM_ROOT.'/inc/database.inc');
-require(SYSTEM_ROOT.'/inc/nodes.inc');
+require(INCLUDE_DIR.'/log.inc');
+require(INCLUDE_DIR.'/database.inc');
+require(INCLUDE_DIR.'/nodes.inc');
$db=new CLASS_DATABASE();
$set=$db->query("select node_id from nodes where node_type='13'");
-?>
\ No newline at end of file
+?>
$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
require($dir.'/../wwwroot/config/config.inc');
-require('../config/config.inc');
require(INCLUDE_DIR.'/database.inc');
require(INCLUDE_DIR.'/senate.inc');
+require(INCLUDE_DIR.'/log.inc');
$db = new CLASS_DATABASE();
$db->query('update users set user_k = '. DAILY_K);
#!/usr/bin/php
<?php
+/*
+ * Script that logouts iddle users.
+ * Called twice a hour.
+ */
-//XXX fix full path
-require('/storage/system/www-docroot/kyberia/config/config.inc');
-//require(SYSTEM_ROOT.'/inc/log.inc');
-require(SYSTEM_ROOT.'/inc/database.inc');
-//require(SYSTEM_ROOT.'/inc/nodes.inc');
+// Use relative address of config file
+// Change this, if you move you cron directory.
+$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
+require($dir.'/../wwwroot/config/config.inc');
+
+//require(INCLUDE_DIR.'/log.inc');
+require(INCLUDE_DIR.'/inc/database.inc');
+//require(INCLUDE_DIR.'/nodes.inc');
+
$db=new CLASS_DATABASE();
$db->query("update users set user_action=NULL,user_action_id=NULL,user_location_vector=NULL where unix_timestamp()-3600>unix_timestamp(last_action)");
?>
#!/usr/local/bin/php
<?php
+
+/*
+ * Script that XXX
+ * Called XXX
+ */
+
+
//registration question specification
$requests[] = array("senate_request"=>2228983,
"function"=>"update_template",
chown(OWN_TEMPLATE_DIR.$node_id.".tpl","www");
}
-require('../config/config.inc');
+// Use relative address of config file
+// Change this, if you move you cron directory.
+$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
+require($dir.'/../wwwroot/config/config.inc');
+
//connecting to database and creating universal $db object
-require(SYSTEM_ROOT.'/inc/log.inc');
-require(SYSTEM_ROOT.'/inc/database.inc');
-require(SYSTEM_ROOT.'/inc/nodes.inc');
-require(SYSTEM_ROOT.'/inc/senate.inc');
+require(INCLUDE_DIR.'/log.inc');
+require(INCLUDE_DIR.'/database.inc');
+require(INCLUDE_DIR.'/nodes.inc');
+require(INCLUDE_DIR.'/senate.inc');
$db=new CLASS_DATABASE();
foreach ($requests as $request) {
}
-?>
\ No newline at end of file
+?>
#!/usr/local/bin/php
<?php
-require('../config/config.inc');
-require(SYSTEM_ROOT.'/inc/log.inc');
-require(SYSTEM_ROOT.'/inc/database.inc');
-require(SYSTEM_ROOT.'/inc/nodes.inc');
-require(SYSTEM_ROOT.'/inc/permissions.inc');
-require(SYSTEM_ROOT.'/inc/ubik.inc');
-require(SYSTEM_ROOT.'/inc/senate.inc');
+/*
+ * Script that register new users who gaind enough K (votes)
+ * Called XXX
+ */
+
+
+// Use relative address of config file
+// Change this, if you move you cron directory.
+$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
+require($dir.'/../wwwroot/config/config.inc');
+
+require(INCLUDE_DIR.'/log.inc');
+require(INCLUDE_DIR.'/database.inc');
+require(INCLUDE_DIR.'/nodes.inc');
+require(INCLUDE_DIR.'/permissions.inc');
+require(INCLUDE_DIR.'/ubik.inc');
+require(INCLUDE_DIR.'/senate.inc');
//REGISTRATION_VOTES CONSTANT DEFINED IN INC/SENATE.INC
define('REGISTER_TEXT','request for access');
$db=new CLASS_DATABASE();
$q="select users.login as persona,users.email as email,
-k,node_id,node_creator,login from nodes
-left join users on nodes.node_creator=users.user_id
-where node_name like '".REGISTER_TEXT."%'
-and node_parent=".REGISTRATION_REQUEST_NODE."
-and k >=".REGISTRATION_VOTES;
+ k,node_id,node_creator,login from nodes
+ left join users on nodes.node_creator=users.user_id
+ where node_name like '".REGISTER_TEXT."%'
+ and node_parent=".REGISTRATION_REQUEST_NODE."
+ and k >=".REGISTRATION_VOTES;
$set=$db->query($q);
$db->update($q);
$login=$set->getString('login');
echo $login." registered\n";
- $db->update("update nodes set template_id=7,external_link='db://users',node_name='$login' where node_id=".$set->getString('node_id'));
+ $db->update("update nodes set
+ template_id=7,
+ external_link='db://users',
+ node_name='$login'
+ where node_id=".$set->getString('node_id'));
$mail=$set->getString('email');
mail($mail,"kyberia gate is opened","Vitaj v kyberii");
//VHODNE POSLAT ZACIATOCNIKOVI POSTU
// ubik::ubikMail($params);
-
}
-?>
\ No newline at end of file
+?>
#!/usr/local/bin/php
<?php
-require('../config/config.inc');
+/*
+ * Script that restores number of K for all users.
+ * Called once a day.
+ */
+
+
+// Use relative address of config file
+// Change this, if you move you cron directory.
+$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
+require($dir.'/../wwwroot/config/config.inc');
+
//connecting to database and creating universal $db object
-require(SYSTEM_ROOT.'/inc/log.inc');
-require(SYSTEM_ROOT.'/inc/database.inc');
-require(SYSTEM_ROOT.'/inc/nodes.inc');
+require(INCLUDE_DIR.'/log.inc');
+require(INCLUDE_DIR.'/database.inc');
+require(INCLUDE_DIR.'/nodes.inc');
+
+// include lastRSS library
+include INCLUDE_DIR.'/lastRSS.php';
+
+
$db=new CLASS_DATABASE();
$set=$db->query("select nodes.*,node_content.*,nodes.node_id as node_id from nodes left join node_content on nodes.node_id=node_content.node_id where node_type='28' and nodes.node_id>100");
-// include lastRSS library
-include '../inc/lastRSS.php';
-
// create lastRSS object
$rss = new lastRSS;
$rss->cache_dir = './cache';
$rss->cache_time = 3600; // one hour
+// XXX WTF
while ($set->next()) {
-// load some RSS file
+// load some RSS file
if (!preg_match("/http:(.*)/",$set->getString('node_content'))) {
$rs = $rss->get("http://kyberia.sk/scripts/google2rss.php?num=25&q=".$set->getString('node_content'));
}
-?>
\ No newline at end of file
+?>
#!/usr/bin/php
<?php
-require('/storage/system/www-root/kyberia.sk/config/config.inc');
-require(SYSTEM_ROOT.'/inc/database.inc');
-require(SYSTEM_ROOT.'/inc/senate.inc');
+/*
+ * Script that XXX put xapian here?
+ * Called XXX
+ */
+
+// Use relative address of config file
+// Change this, if you move you cron directory.
+$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
+require($dir.'/../wwwroot/config/config.inc');
+
+require(INCLUDE_DIR.'/database.inc');
+require(INCLUDE_DIR.'/senate.inc');
$db = new CLASS_DATABASE();
$db->query('insert into node_content select node_id,node_content from nodes where ( DATE_SUB(CURDATE(),INTERVAL 2 DAY) < node_created OR DATE_SUB(CURDATE(),INTERVAL 2 DAY) < node_updated) ON DUPLICATE KEY UPDATE node_content.node_content = nodes.node_content;');
#!/usr/local/bin/php
<?php
-error_reporting(0);
-//requiring main config file with path/database etc. constants
-require('/storage/system/www-docroot/kyberia.sk/config/config.inc');
+/*
+ * Script that XXX
+ * Called XXX
+ */
+
+//error_reporting(0);
+
+// Use relative address of config file
+// Change this, if you move you cron directory.
+$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
+require($dir.'/../wwwroot/config/config.inc');
//connecting to database and creating universal $db object
-require(SYSTEM_ROOT.'/inc/log.inc');
-require(SYSTEM_ROOT.'/inc/database.inc');
-require(SYSTEM_ROOT.'/inc/nodes.inc');
+require(INCLUDE_DIR.'/log.inc');
+require(INCLUDE_DIR.'/database.inc');
+require(INCLUDE_DIR.'/nodes.inc');
$db=new CLASS_DATABASE();
-$set=$db->query("select nodes.*,node_content from nodes left join node_content on node_content.node_id=nodes.node_id where node_system_access='public' and date(node_created)<=current_date()-interval 1 day and (nodes.k>0 or nodes.node_views>0)");
+$set=$db->query("select nodes.*,node_content from nodes
+ left join node_content on node_content.node_id=nodes.node_id
+ where node_system_access='public' and
+ date(node_created)<=current_date()-interval 1 day and
+ (nodes.k>0 or nodes.node_views>0)");
while ($set->next()) {
$node_id=$set->getString('node_id');
$node_content=$set->getString('node_content');
#!/usr/local/bin/php
<?php
-require('../config/config.inc');
+/*
+ * Script that XXX ? create template files from sql ?
+ * Called XXX
+ */
+
+
+// Use relative address of config file
+// Change this, if you move you cron directory.
+$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
+require($dir.'/../wwwroot/config/config.inc');
+
//connecting to database and creating universal $db object
-require(SYSTEM_ROOT.'/inc/log.inc');
-require(SYSTEM_ROOT.'/inc/database.inc');
-require(SYSTEM_ROOT.'/inc/nodes.inc');
+require(INCLUDE_DIR.'/log.inc');
+require(INCLUDE_DIR.'/database.inc');
+require(INCLUDE_DIR.'/nodes.inc');
$db=new CLASS_DATABASE();
-$set=$db->query("select nodes.*,node_content.*,nodes.node_id as node_id from nodes left join node_content on nodes.node_id=node_content.node_id where node_type='14'");
+$set=$db->query("select nodes.*,node_content.*,nodes.node_id as node_id from nodes
+ left join node_content on nodes.node_id=node_content.node_id
+ where node_type='14'");
while ($set->next()) {
$node_content=$set->getString('node_content');
chown(OWN_TEMPLATE_DIR.$template_id.".tpl","www");
}
-
-
-
-
-?>
\ No newline at end of file
+?>
function query($sql) {
-// if (preg_match("/^select/i",$sql) && (rand(0,1000)>MASTER2SLAVE) && $this->Master) {
-// every select query goes to onyx + opraveny regexp, aby matchoval vnorene selecty (br)
-/* if (preg_match('/^\(?select/i',$sql) && $this->Master) {
- $this->_linkId = false;
- $this->connect(SLAVE_HOST,SLAVE_USER,SLAVE_PASS,SLAVE_DATABASE);
- $this->Master = false;
-
- }
-
- elseif (!preg_match("/^select/i",$sql) && !$this->Master) {
-*/ $this->_linkId = false;
- $this->connect(DB_HOST,DB_USER,DB_PASS,DB_DATABASE);
- $this->Master = true;
-// }
+ $this->_linkId = false;
+ $this->connect(DB_HOST,DB_USER,DB_PASS,DB_DATABASE);
+ $this->Master = true;
$this->_queryId = mysql_query($sql,$this->_linkId);
- if ($_SESSION['debugging']) {
- if ($this->Master) echo "Master::";
- else echo "Slave::";
+ if (isset($_SESSION['debugging'])) {
echo $sql;
global $timer_start;
echo "<BR>".SubStr((Time()+SubStr(MicroTime(),0,8)-$timer_start),0,7);