function ReadFromFields() { $args = ParseCommandLine(); $query = 'SELECT * FROM `tbx_video_feed`'; if (isset($args['feeds'])) { $ids = array(); foreach (explode(',', $args['feeds']) as $id) { $id = trim($id); $range = explode('-', $id); if (count($range) == 2) { $ids = array_merge($ids, range($range[0], $range[1])); } else { $ids[] = $id; } } $ids = preg_grep('~^\\d+$~', $ids); if (!empty($ids)) { $query .= ' WHERE `feed_id` IN (' . join(',', $ids) . ')'; } } $DB = GetDB(); $result = $DB->Query($query); while ($feed = $DB->NextRow($result)) { $vf = Video_Feed::Create($feed); $imported = $vf->Import(); } $DB->Free($result); }
function DailyPartnerMaintenance() { global $DB, $C; $args = ParseCommandLine(); // Remove inactive partner accounts if (isset($args['remove-inactive']) && is_numeric($args['remove-inactive'])) { $min_last_submit = gmdate(DF_DATETIME, TimeWithTz() - $args['remove-inactive'] * 86400); $result = $DB->Query('SELECT * FROM `tx_partners` WHERE `date_last_submit` <= ? OR (`date_last_submit` IS NULL AND `date_added` <= ?)', array($min_last_submit, $min_last_submit)); while ($partner = $DB->NextRow($result)) { DeletePartner($partner['username'], $partner); } $DB->Free($result); } // Send an e-mail message to partner accounts that are inactive if (isset($args['email-inactive']) && is_numeric($args['email-inactive'])) { // Prepare the template $t = new Template(); $t->assign_by_ref('config', $C); $t->assign('inactive', $args['email-inactive']); // Determine the time range to select $start = gmdate(DF_DATE, strtotime('-' . $args['email-inactive'] . ' day', TimeWithTz())) . ' 00:00:00'; $end = gmdate(DF_DATE, strtotime('-' . $args['email-inactive'] . ' day', TimeWithTz())) . ' 23:59:59'; // Find matching partners $result = $DB->Query('SELECT * FROM `tx_partners` WHERE `date_last_submit` BETWEEN ? AND ? OR (`date_last_submit` IS NULL AND `date_added` BETWEEN ? AND ?)', array($start, $end, $start, $end)); while ($partner = $DB->NextRow($result)) { $t->assign_by_ref('partner', $partner); SendMail($partner['email'], 'email-partner-inactive.tpl', $t); } $DB->Free($result); } // Send an e-mail message to partner accounts that are expiring soon if (isset($args['email-expiring']) && is_numeric($args['email-expiring'])) { // Prepare the template $t = new Template(); $t->assign_by_ref('config', $C); // Determine the time range to select $start = gmdate(DF_DATE, strtotime('+' . $args['email-expiring'] . ' day', TimeWithTz())) . ' 00:00:00'; $end = gmdate(DF_DATE, strtotime('+' . $args['email-expiring'] . ' day', TimeWithTz())) . ' 23:59:59'; // Find matching partners $result = $DB->Query('SELECT * FROM `tx_partners` WHERE `date_end` BETWEEN ? AND ?', array($start, $end)); while ($partner = $DB->NextRow($result)) { $partner['date_end'] = strtotime($partner['date_end']); $t->assign_by_ref('partner', $partner); SendMail($partner['email'], 'email-partner-expiring.tpl', $t); } $DB->Free($result); } }
exit; } // Temporary root. $rootpath = str_replace("\\", "/", dirname(__FILE__)); require_once $rootpath . "/config.php"; require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/debug.php"; require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/cli.php"; require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/str_basics.php"; require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/page_basics.php"; require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/sso_functions.php"; require_once SSO_ROOT_PATH . "/" . SSO_SUPPORT_PATH . "/random.php"; $sso_start = microtime(true); SetDebugLevel(); // Process the command-line options. $options = array("shortmap" => array("d" => "debug", "v" => "verbose", "?" => "help"), "rules" => array("debug" => array("arg" => false), "verbose" => array("arg" => false), "help" => array("arg" => false))); $sso_args = ParseCommandLine($options); if (count($sso_args["params"]) != 0 || isset($sso_args["opts"]["help"])) { echo "SSO Server Cron Interface\n"; echo "Purpose: Run cleanup operations that need to be executed periodically.\n"; echo "\n"; echo "Syntax: " . $args["file"] . " [options]\n"; echo "Options:\n"; echo "\t-d Output debugging information.\n"; echo "\t-v Verbose output.\n"; echo "\t-? This help documentation.\n"; exit; } $sso_debug = isset($sso_args["opts"]["debug"]); $sso_verbose = isset($sso_args["opts"]["verbose"]); // Initialize language settings. BB_InitLangmap(SSO_ROOT_PATH . "/" . SSO_LANG_PATH . "/", SSO_DEFAULT_LANG);
$Method = self::$PasswordFormats[$Method]; } else { $Method = 'sha1'; } $Result = $Method . '$' . $Salt . '$' . $Hash . '$'; return $Result; } protected function _ExportConversationTemps() { $Sql = "\n drop table if exists z_pmto;\n\n create table z_pmto (\n PM_ID int unsigned,\n User_ID int,\n Deleted tinyint,\n primary key(PM_ID, User_ID)\n );\n\n insert ignore z_pmto (\n PM_ID,\n User_ID,\n Deleted\n )\n select\n PMessageID,\n FromUserID,\n 0\n from yaf_PMessage;\n\n replace z_pmto (\n PM_ID,\n User_ID,\n Deleted\n )\n select\n PMessageID,\n UserID,\n IsDeleted\n from yaf_UserPMessage;\n\n drop table if exists z_pmto2;\n create table z_pmto2 (\n PM_ID int unsigned,\n UserIDs varchar(250),\n primary key (PM_ID)\n );\n\n replace z_pmto2 (\n PM_ID,\n UserIDs\n )\n select\n PM_ID,\n group_concat(User_ID order by User_ID)\n from z_pmto\n group by PM_ID;\n\n drop table if exists z_pmtext;\n create table z_pmtext (\n PM_ID int unsigned,\n Title varchar(250),\n Title2 varchar(250),\n UserIDs varchar(250),\n Group_ID int unsigned\n );\n\n insert z_pmtext (\n PM_ID,\n Title,\n Title2\n )\n select\n PMessageID,\n Subject,\n case when Subject like 'Re:%' then trim(substring(Subject, 4)) else Subject end as Title2\n from yaf_PMessage;\n\n create index z_idx_pmtext on z_pmtext (PM_ID);\n\n update z_pmtext pm\n join z_pmto2 t\n on pm.PM_ID = t.PM_ID\n set pm.UserIDs = t.UserIDs;\n\n drop table if exists z_pmgroup;\n\n create table z_pmgroup (\n Group_ID int unsigned,\n Title varchar(250),\n UserIDs varchar(250)\n );\n\n insert z_pmgroup (\n Group_ID,\n Title,\n UserIDs\n )\n select\n min(pm.PM_ID),\n pm.Title2,\n t2.UserIDs\n from z_pmtext pm\n join z_pmto2 t2\n on pm.PM_ID = t2.PM_ID\n group by pm.Title2, t2.UserIDs;\n\n create index z_idx_pmgroup on z_pmgroup (Title, UserIDs);\n create index z_idx_pmgroup2 on z_pmgroup (Group_ID);\n\n update z_pmtext pm\n join z_pmgroup g\n on pm.Title2 = g.Title and pm.UserIDs = g.UserIDs\n set pm.Group_ID = g.Group_ID;"; $this->Ex->QueryN($Sql); } } // If running from cli, execute its command. if (defined('CONSOLE')) { ParseCommandLine(); } // Instantiate the appropriate controller or display the input page. $Method = 'DoExport'; if (isset($_REQUEST['features'])) { // Feature list or table. $Set = isset($_REQUEST['cloud']) ? array('core', 'addons', 'cloud') : false; $Set = VanillaFeatures($Set); if (isset($_REQUEST['type'])) { ViewFeatureList($_REQUEST['type'], $Set); } else { ViewFeatureTable($Set); } } elseif (isset($_POST['type'])) { if (array_key_exists($_POST['type'], $Supported)) { // Mini-Factory for conducting exports.