* @package provisioner * * */ $keywordArray = array(); $outputArray = array(); /* Protection */ if (REVO_GATEWAY_OPEN != "true") { die("Revo Gateway API error - Invalid access"); } /* Get the keywords from the database */ $db = connectToDb(); /* Get the keywords */ logImportEvent("Getting all keywords", $db); $sql = "SELECT keyword, content_id FROM " . $table_prefix . "site_keywords"; $sql .= " LEFT JOIN " . $table_prefix . "keyword_xref on id = keyword_id"; $result = mysql_query($sql, $db); if (!$result) { die("Revo Gateway API error - Invalid Keyword query"); } while ($keyword = mysql_fetch_assoc($result)) { $keywordArray[] = $keyword; } /* Assemble the output array, list of mapped resources indexed by keyword */ foreach ($keywordArray as $keyword) { $outputArray[$keyword['keyword']][] = $keyword['content_id']; } $response = errorSuccess('', $outputArray); logImportEvent("Got all keywords", $db); mysql_close($db); echo toJSON($response);
/** * Provisoner files evolution component * * @category Provisioning * @author S. Hamblett <*****@*****.**> * @copyright 2010 S. Hamblett * @license GPLv3 http://www.gnu.org/licenses/gpl.html * @link none * * @package provisioner * */ /* Protection */ if (REVO_GATEWAY_OPEN != "true") { die("Revo Gateway API error - Invalid access"); } /* format filename */ $file = rawurldecode($scriptProperties['file']); if (!file_exists($file)) { $response = errorFailure(" : No file found : ", array('name' => $file)); echo json_encode($response); return; } $filename = ltrim(strrchr($file, '/'), '/'); /* Encode into base64 for transmission */ $fbuffer = @file_get_contents($file); $fbuffer = base64_encode($fbuffer); $time_format = '%b %d, %Y %H:%I:%S %p'; $fa = array('name' => utf8_encode($filename), 'size' => filesize($file), 'last_accessed' => strftime($time_format, fileatime($file)), 'last_modified' => strftime($time_format, filemtime($file)), 'content' => $fbuffer); $response = errorSuccess('', $fa); echo toJSON($response);
$result = mysql_query($sql, $db); $userMain = mysql_fetch_assoc($result); $user['username'] = $userMain['username']; $user['password'] = $userMain['password']; $response = errorSuccess('', $user); } } else { $sql = "SELECT * FROM " . $table_prefix . "web_user_attributes " . "WHERE `internalKey` = " . "'" . $scriptProperties['id'] . "'"; $result = mysql_query($sql, $db); if (mysql_num_rows($result) != 1) { $response = errorFailure("No web user found", array('id' => $id)); mysql_close($db); echo json_encode($response); return; } else { $user = mysql_fetch_assoc($result); $sql = "SELECT * FROM " . $table_prefix . "web_users " . "WHERE `id` = " . "'" . $scriptProperties['id'] . "'"; $result = mysql_query($sql, $db); $userMain = mysql_fetch_assoc($result); $user['username'] = $userMain['username']; $user['password'] = $userMain['password']; $response = errorSuccess('', $user); } } /* Formatting */ $user['dob'] = !empty($user['dob']) ? strftime('%m/%d/%Y', $user['dob']) : ''; $user['blockeduntil'] = !empty($user['blockeduntil']) ? strftime('%m/%d/%Y %I:%M %p', $user['blockeduntil']) : ''; $user['blockedafter'] = !empty($user['blockedafter']) ? strftime('%m/%d/%Y %I:%M %p', $user['blockedafter']) : ''; $user['lastlogin'] = !empty($user['lastlogin']) ? strftime('%m/%d/%Y', $user['lastlogin']) : ''; mysql_close($db); echo toJSON($response);
break; case 'tv': $sql = "SELECT * FROM " . $table_prefix . "site_tmplvars" . " WHERE `id` = " . $id; $result = mysql_query($sql, $db); if (mysql_num_rows($result) == 0) { $response = errorFailure("No TV found", array('id' => $id)); } else { $element = mysql_fetch_assoc($result); $response = errorSuccess('', $element); } mysql_close($db); echo toJSON($response); break; case 'category': $sql = "SELECT * FROM " . $table_prefix . "categories" . " WHERE `id` = " . $id; $result = mysql_query($sql, $db); if (mysql_num_rows($result) == 0) { $response = errorFailure("No category found", array('id' => $id)); } else { $category = mysql_fetch_assoc($result); $category['parent'] = 0; $response = errorSuccess('', $category); } mysql_close($db); echo toJSON($response); break; default: $response = errorFailure("No such element type", array('type' => $type)); mysql_close($db); echo toJSON($response); }
* * @category Provisioning * @author S. Hamblett <*****@*****.**> * @copyright 2010 S. Hamblett * @license GPLv3 http://www.gnu.org/licenses/gpl.html * @link none * * @package provisioner * * */ $metatagArray = array(); /* Protection */ if (REVO_GATEWAY_OPEN != "true") { die("Revo Gateway API error - Invalid access"); } /* Get the resources from the database */ $db = connectToDb(); logImportEvent("Getting all metatags", $db); $sql = "SELECT * FROM " . $table_prefix . "site_metatags "; $result = mysql_query($sql, $db); if (!$result) { die("Revo Gateway API error - Invalid Resource query"); } while ($metatag = mysql_fetch_assoc($result)) { $metatagArray[] = $metatag; } $response = errorSuccess('', $metatagArray); logImportEvent("Got all metatags", $db); mysql_close($db); echo toJSON($response);
<?php /** * Provisioner evolution gateway controller * * @category Provisioning * @author S. Hamblett <*****@*****.**> * @copyright 2009 S. Hamblett * @license GPLv3 http://www.gnu.org/licenses/gpl.html * @link none * * @package provisioner */ require_once 'connectors/common/support.php'; $response = errorSuccess('', null); echo json_encode($response);
* * @package provisioner * * */ $resourceArray = array(); /* Protection */ if (REVO_GATEWAY_OPEN != "true") { die("Revo Gateway API error - Invalid access"); } /* Get the resources from the database */ $db = connectToDb(); logImportEvent("Getting all resources", $db); $sql = "SELECT * FROM " . $table_prefix . "site_content "; $result = mysql_query($sql, $db); if (!$result) { die("Revo Gateway API error - Invalid Resource query"); } while ($resource = mysql_fetch_assoc($result)) { /* Set the class key for correct creation in Revolution */ if ($resource['type'] == 'reference') { $resource['class_key'] = 'modWebLink'; } else { $resource['class_key'] = 'modDocument'; } $resourceArray[] = $resource; } $response = errorSuccess('', $resourceArray); logImportEvent("Got all resources", $db); mysql_close($db); echo toJSON($response);
break; case 'tv': logImportEvent("Getting all TVs", $db); $sql = "SELECT * FROM " . $table_prefix . "site_tmplvars"; $result = mysql_query($sql, $db); while ($element = mysql_fetch_assoc($result)) { $elementArray[] = $element; } $response = errorSuccess('', $elementArray); logImportEvent("Got all TVs", $db); mysql_close($db); echo toJSON($response); break; case 'category': logImportEvent("Getting all categories", $db); $sql = "SELECT * FROM " . $table_prefix . "categories"; $result = mysql_query($sql, $db); while ($category = mysql_fetch_assoc($result)) { $category['parent'] = 0; $elementArray[] = $category; } $response = errorSuccess('', $elementArray); logImportEvent("Got all categories", $db); mysql_close($db); echo toJSON($response); break; default: $response = errorFailure("No such element type", array('type' => $type)); mysql_close($db); echo toJSON($response); }
* * */ /* Protection */ if (REVO_GATEWAY_OPEN != "true") { die("Revo Gateway API error - Invalid access"); } /* Get the resource from the database */ $db = connectToDb(); $sql = "SELECT * FROM " . $table_prefix . "site_content " . "WHERE `id` = " . $scriptProperties['id']; $result = mysql_query($sql, $db); if (!$result) { die("Revo Gateway API error - Invalid Resource query"); } if (mysql_num_rows($result) == 1) { $resource = mysql_fetch_assoc($result); } else { $response = errorFailure("No resource found", array('id' => $scriptProperties['id'])); mysql_close($db); echo json_encode($response); return; } /* Set the class key for correct creation in Revolution */ if ($resource['type'] == 'reference') { $resource['class_key'] = 'modWebLink'; } else { $resource['class_key'] = 'modDocument'; } $response = errorSuccess('', $resource); mysql_close($db); echo toJSON($response);